From c2a5aba55fc7124e85fb3628f17c64ee6d5f0499 Mon Sep 17 00:00:00 2001 From: Vojtech Bocek Date: Tue, 5 Mar 2024 16:29:33 +0100 Subject: [PATCH] fix: all examples in GH Actions --- .github/workflows/build-test.yml | 15 +++++++++++++-- examples/mpu/main.cpp | 10 ++++++++-- examples/oled/main.cpp | 4 ++-- src/RBCXMpu.h | 3 +-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index a0af7c2..71cc361 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -8,7 +8,18 @@ jobs: strategy: matrix: example: - - examples/motors + - battery + - buzzer + - leds + - motorDriveToPosition + - motorPower + - motors + - mpu + - oled + - readEncoderPosition + - stupidServos + - ultrasoundBasic + - ultrasoundLeds steps: - uses: actions/checkout@v1 - name: Set up Python @@ -20,4 +31,4 @@ jobs: - name: Build examples run: platformio ci --lib="." --project-conf="./platformio.ini" env: - PLATFORMIO_CI_SRC: ${{ matrix.example }} + PLATFORMIO_CI_SRC: examples/${{ matrix.example }} diff --git a/examples/mpu/main.cpp b/examples/mpu/main.cpp index 35b851e..7f28f11 100644 --- a/examples/mpu/main.cpp +++ b/examples/mpu/main.cpp @@ -26,13 +26,19 @@ void setup() { auto& mpu = rb::Manager::get().mpu(); mpu.init(); + + // sets the 0 positions to current RBCX orientation + mpu.calibrateNow(); + delay(1000); + mpu.sendStart(); while (true) { - printf("MPU - angle: X: %2.2f Y: %2.2f Z: %2.2f\n", mpu.getAngleX(), mpu.getAngleY(), mpu.getAngleZ()); + auto angle = mpu.getAngle(); + printf("MPU - angle: X: %2.2f Y: %2.2f Z: %2.2f\n", angle.x, angle.y, angle.z); delay(100); } } -void loop() {} \ No newline at end of file +void loop() {} diff --git a/examples/oled/main.cpp b/examples/oled/main.cpp index 278d5d1..73dfc7b 100644 --- a/examples/oled/main.cpp +++ b/examples/oled/main.cpp @@ -56,7 +56,7 @@ void setup() { oled.setCursor(5, oled.getHeight()/2); String text = "OLED w:" + String(oled.getWidth()) + " | h:" + String(oled.getHeight()); - oled.writeString(text, rb::Oled::Font_7x10, rb::Oled::White); + oled.writeString(text.c_str(), rb::Oled::Font_7x10, rb::Oled::White); oled.updateScreen(); waitToNextTest(); @@ -95,4 +95,4 @@ void setup() { } } -void loop() {} \ No newline at end of file +void loop() {} diff --git a/src/RBCXMpu.h b/src/RBCXMpu.h index 600ed2f..4d93f62 100644 --- a/src/RBCXMpu.h +++ b/src/RBCXMpu.h @@ -6,7 +6,6 @@ #include "rbcx.pb.h" - namespace rb { struct MpuVector { @@ -82,7 +81,7 @@ class Mpu { /** * @brief Restores calibration data previously obtained from calibrateNow callback */ - void restoreCalibrationData(const uint8_t *data, size_t length); + void restoreCalibrationData(const uint8_t* data, size_t length); /** * @brief Restores calibration data previously obtained from calibrateNow callback