Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/cmake_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: DoozyX/clang-format-lint-action@v0.18
with:
source: '.'
Expand All @@ -18,9 +18,9 @@ jobs:
cmake-format-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.9'
- run: |
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Build and deploy
container: ghcr.io/arendjan/pico_docker_image:main
steps:
- uses: actions/checkout@main
- uses: actions/checkout@v6
with:
submodules: true
- name: build
Expand All @@ -29,26 +29,26 @@ jobs:
run: |
cp ./build2/Telemetrix4RpiPico.uf2 ./
cp ./build2/Telemetrix4RpiPico.elf ./
- name: install nodejs
run: |
apt update
apt install curl unzip -y
curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
chmod +x nodesource_setup.sh
./nodesource_setup.sh
apt-get install -y nodejs
node -v
# - name: install nodejs
# run: |
# apt update
# apt install curl unzip -y
# curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
# chmod +x nodesource_setup.sh
# ./nodesource_setup.sh
# apt-get install -y nodejs
# node -v
- name: Put environment variable into the env context
run: echo "app_name=$APP_NAME" >> $GITHUB_ENV
- name: Archive production artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: dist
path: |
Telemetrix4RpiPico.uf2
Telemetrix4RpiPico.elf
- name: Push to release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
Expand All @@ -58,7 +58,7 @@ jobs:
- name: Check if mirte-sd-image-tools has release with same tag
id: check_release
if: startsWith(github.ref, 'refs/tags/')
uses: actions/github-script@v8
uses: actions/github-script@v9
with:
script: |
const tag = process.env.GITHUB_REF.replace('refs/tags/', '');
Expand All @@ -81,7 +81,7 @@ jobs:
result-encoding: string
- name: Push artifacts to sd-image-tools release if it exists
if: startsWith(github.ref, 'refs/tags/') && steps.check_release.outputs.result == 'true'
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v3
with:
repository: ${{ github.repository_owner }}/mirte-sd-image-tools
files: |
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "rp2040-serial-bootloader"]
path = rp2040-serial-bootloader
url = https://github.com/arendjan/rp2040-serial-bootloader.git
[submodule "libs/MIRTE_Adafruit_BNO055"]
path = libs/MIRTE_Adafruit_BNO055
url = https://github.com/ArendJan/MIRTE_Adafruit_BNO055.git
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ set(PICO_USE_FASTEST_SUPPORTED_CLOCK 100)
add_executable(
Telemetrix4RpiPico
src/Telemetrix4RpiPico.cpp
src/mirte_master.cpp
src/i2c_helpers.cpp
src/uart.cpp
src/serialization.cpp
Expand All @@ -49,17 +50,21 @@ add_executable(
src/drivers/INA226v2.cpp
src/drivers/VL53L0.cpp
src/drivers/neopixel.cpp
src/drivers/MPU6050.cpp
src/module/Hiwonder_Servo.cpp
src/module/PCA9685_Module.cpp
src/sensors/MPU6050_sensor.cpp
src/module/module.cpp
src/module/tmx_ssd1306_Module.cpp
src/module/Shutdown_Module.cpp
src/sensors/adxl345_sensor.cpp
src/sensors/gps_sensor.cpp
src/sensors/hmc5883l_sensor.cpp
src/sensors/hx711_sensor.cpp
src/sensors/as5600_sensor.cpp
src/sensors/ina226_sensor.cpp
src/sensors/mpu9250_sensor.cpp
src/sensors/bno055_sensor.cpp
src/sensors/sensor.cpp
src/sensors/sonar.cpp
src/sensors/veml6040_sensor.cpp
Expand All @@ -85,7 +90,7 @@ pico_enable_stdio_uart(Telemetrix4RpiPico 1) # TODO: For master version this
# must be disabled
pico_add_extra_outputs(Telemetrix4RpiPico)
add_subdirectory(pico-ssd1306)

add_subdirectory(libs/MIRTE_Adafruit_BNO055)
target_link_libraries(
Telemetrix4RpiPico
pico_stdlib
Expand All @@ -101,7 +106,8 @@ target_link_libraries(
hardware_flash
pico_sync
pico_multicore
pico_ssd1306)
pico_ssd1306
Adafruit_BNO055)

set(SKIP_BOOTLOADER_ENTRY_PIN 1)
add_subdirectory(rp2040-serial-bootloader)
Expand Down
16 changes: 1 addition & 15 deletions include/Telemetrix4RpiPico.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,7 @@ void readSensors();
extern std::vector<Sensor *> sensors;
void reportBytes(std::vector<uint8_t>);
extern uint8_t command_buffer[MAX_COMMAND_LENGTH];
// class Shutdown_Relay : public Module {
// public:
// Shutdown_Relay(std::vector<uint8_t> &data);
// void readModule();
// void writeModule(std::vector<uint8_t> &data);
// void resetModule(){};

// private:
// int pin = 0;
// bool enabled = false;
// bool enable_on = true;
// int wait_time = 10;
// decltype(time_us_32()) start_time = 0;
// };

extern int packet_size;
extern std::vector<Module *> modules;
void module_new();
void module_data();
Expand Down
18 changes: 18 additions & 0 deletions include/drivers/MPU6050.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include <hardware/i2c.h>
#include <stdint.h>
// driver for MPU6050, 6-axis IMU
#include <stdint.h>
class MPU6050 {
public:
MPU6050(i2c_inst_t *i2c_port, uint8_t addr);
void read(int16_t accel[3], int16_t gyro[3], int16_t *temp);
void reset();
bool ok = true; // tracks whether the device is responding correctly, if not
// we skip reads to avoid blocking

private:
i2c_inst_t *i2c_port;
uint8_t addr;
};
1 change: 1 addition & 0 deletions include/message_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ const uint DHT_MAX_TIMINGS = 85;
#define ENCODER_TYPE 1
#define ENCODER_PIN_A 2
#define ENCODER_PIN_B 3
#define ENCODER_PULLS 4

// Max encoder devices
#define MAX_ENCODERS 4
Expand Down
8 changes: 8 additions & 0 deletions include/mirte_master.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

#define ENABLE_MIRTE_MASTER 1

extern bool is_mm;
void mm_detect();

void mm_loop();
23 changes: 23 additions & 0 deletions include/module/Shutdown_Module.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once
#include "hardware/clocks.h"
#include "hardware/gpio.h"
#include "hardware/timer.h"
#include "module.hpp"
#include "watchdog.hpp"
#include <vector>

class Shutdown_Relay : public Module {
public:
Shutdown_Relay(std::vector<uint8_t> &data);
void readModule();
void writeModule(std::vector<uint8_t> &data);
void resetModule() {};
void core1_update() {};

private:
int pin = 0;
bool enabled = false;
bool enable_on = true;
int wait_time = 10;
decltype(time_us_32()) start_time = 0;
};
14 changes: 14 additions & 0 deletions include/sensors/MPU6050_sensor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once
#include "drivers/MPU6050.hpp"
#include "sensor.hpp"
#include <stdlib.h>
#include <vector>
class MPU6050_Module : public Sensor {
public:
MPU6050_Module(uint8_t settings[SENSORS_MAX_SETTINGS_A]);
void readSensor();
void resetSensor();

private:
MPU6050 *mpu;
};
14 changes: 14 additions & 0 deletions include/sensors/bno055_sensor.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once
#include "Adafruit_BNO055.h"
#include "sensor.hpp"
#include <stdlib.h>
#include <vector>
class BNO055_Sensor : public Sensor {
public:
BNO055_Sensor(uint8_t settings[SENSORS_MAX_SETTINGS_A]);
void readSensor();
void resetSensor() {};

private:
Adafruit_BNO055 *bno;
};
2 changes: 2 additions & 0 deletions include/sensors/sensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ enum SENSOR_TYPES : uint8_t { // Max 255 sensors, but will always fit in a
INA226a = 6,
HMC5883l = 7,
AS5600_t = 8,
MPU6050_t = 9,
BNO055_t = 10,
MAX_SENSORS
};

Expand Down
2 changes: 1 addition & 1 deletion include/serialization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ std::vector<uint8_t> encode_i16(const int16_t &value);
std::vector<uint8_t> encode_i32(const int32_t &value);
std::vector<uint8_t> encode_i64(const int64_t &value);

// std::vector<uint8_t> encode_float(const float &value);
std::vector<uint8_t> encode_float(const float &value);

// Decode
uint16_t decode_u16(const std::span<const uint8_t, 2> &data);
Expand Down
10 changes: 10 additions & 0 deletions include/watchdog.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once
#include <stdint.h>
typedef unsigned int uint;

void enable_watchdog();
void disable_watchdog();
extern bool watchdog_triggered;
void led_debug(int, uint);
extern bool watchdog_enable_shutdown; // if false, then don't do anything with
// the watchdog and just wait for shutdown
1 change: 1 addition & 0 deletions libs/MIRTE_Adafruit_BNO055
Submodule MIRTE_Adafruit_BNO055 added at e8514b
Loading