From bf111d9408903154c9431b5c395a58fb5b1e9c01 Mon Sep 17 00:00:00 2001 From: Mathieu Kaelin Date: Tue, 21 Mar 2023 03:05:13 +0100 Subject: [PATCH 1/4] Create compile-examples.yml --- .github/workflows/compile-examples.yml | 105 +++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 .github/workflows/compile-examples.yml diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml new file mode 100644 index 0000000..4782af7 --- /dev/null +++ b/.github/workflows/compile-examples.yml @@ -0,0 +1,105 @@ +name: Compile Examples + +on: + pull_request: + paths: + - ".github/workflows/compile-examples.yml" + - "examples/**" + - "src/**" + push: + paths: + - ".github/workflows/compile-examples.yml" + - "examples/**" + - "src/**" + +jobs: + build: + runs-on: ubuntu-latest + + env: + SKETCHES_REPORTS_PATH: sketches-reports + + strategy: + fail-fast: false + + matrix: + board: + - fqbn: arduino:avr:uno + platforms: | + - name: arduino:avr + - fqbn: arduino:samd:mkr1000 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrzero + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrwifi1010 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrfox1200 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrwan1300 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrwan1310 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrgsm1400 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrnb1500 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrvidor4000 + platforms: | + - name: arduino:samd + - fqbn: arduino:mbed_rp2040:pico + platforms: | + - name: arduino:mbed_rp2040 + - fqbn: arduino:mbed_portenta:envie_m7 + platforms: | + - name: arduino:mbed_portenta + - fqbn: arduino:mbed_portenta:envie_m4 + platforms: | + - name: arduino:mbed_portenta + - fqbn: arduino:mbed_nano:nano33ble + platforms: | + - name: arduino:mbed_nano + - fqbn: arduino:mbed_nano:nanorp2040connect + platforms: | + - name: arduino:mbed_nano + - fqbn: arduino:mbed_edge:edge_control + platforms: | + - name: arduino:mbed_edge + - fqbn: esp32:esp32:esp32 + platforms: | + - name: esp32:esp32 + source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json + - fqbn: rp2040:rp2040:rpipico + platforms: | + - name: rp2040:rp2040 + source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install ESP32 platform dependencies + if: startsWith(matrix.board.fqbn, 'esp32:esp32') + run: pip3 install pyserial + + - name: Compile examples + uses: arduino/compile-sketches@v1 + with: + fqbn: ${{ matrix.board.fqbn }} + platforms: ${{ matrix.board.platforms }} + enable-deltas-report: true + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Save memory usage change report as artifact + if: github.event_name == 'pull_request' + uses: actions/upload-artifact@v3 + with: + name: ${{ env.SKETCHES_REPORTS_PATH }} + path: ${{ env.SKETCHES_REPORTS_PATH }} \ No newline at end of file From 5ddde3cbdd5b863cef75204a4034f3373b5fc8b5 Mon Sep 17 00:00:00 2001 From: Mathieu Kaelin Date: Tue, 21 Mar 2023 03:22:36 +0100 Subject: [PATCH 2/4] remove unused variable and add parentheses for clarity --- src/mv300sensor.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mv300sensor.cpp b/src/mv300sensor.cpp index 48f4a9c..946f082 100644 --- a/src/mv300sensor.cpp +++ b/src/mv300sensor.cpp @@ -262,7 +262,6 @@ uint8_t MV300SensorI2c::readRegisterWithCrcCheck(uint8_t address, bool *crcError void MV300SensorI2c::writeRegisterWithCrcCheck(uint8_t address, uint8_t value, uint8_t triggerMode) { uint8_t crc = 0; - uint8_t crcReceived; uint8_t data; Wire.beginTransmission(i2cAddress); crc = crc8(crc, (i2cAddress<<1)+0); @@ -406,7 +405,7 @@ uint8_t MV300SensorSpi::readRegisterWithCrcCheck(uint8_t address, bool *crcError digitalWrite(spiChipSelectPin, LOW); delayMicroseconds(7); //tcsl sendValue = ((triggerMode<<6)&0xC0) | ((1<<5)&0x20) | (address&0x1F); - readbackResult = SPI.transfer16((sendValue<<8)&0xFF00 | (crc8(0, sendValue)&0x00FF)); + readbackResult = SPI.transfer16(((sendValue<<8)&0xFF00) | (crc8(0, sendValue)&0x00FF)); readbackValue = (readbackResult>>8)&0xFF; crcReceived = readbackResult&0xFF; crcChecksum = crc8(0,readbackValue); @@ -441,7 +440,7 @@ void MV300SensorSpi::writeRegisterWithCrcCheck(uint8_t address, uint8_t value, b if (crcChecksum != crcReceived) { *crcErrorDetected=true; } - readbackResult = SPI.transfer16((value<<8)&0xFF00 | crc8(0,value)&0x00FF); + readbackResult = SPI.transfer16(((value<<8)&0xFF00) | (crc8(0,value)&0x00FF)); readbackValue = (readbackResult>>8)&0xFF; crcReceived = readbackResult&0xFF; crcChecksum = crc8(0,readbackValue); From cf2e1df3b0dee473294c541581846cecf3f518ac Mon Sep 17 00:00:00 2001 From: Mathieu Kaelin Date: Tue, 21 Mar 2023 04:02:22 +0100 Subject: [PATCH 3/4] remove unsupported envie-M4 board --- .github/workflows/compile-examples.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 4782af7..c952cd1 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -60,9 +60,9 @@ jobs: - fqbn: arduino:mbed_portenta:envie_m7 platforms: | - name: arduino:mbed_portenta - - fqbn: arduino:mbed_portenta:envie_m4 - platforms: | - - name: arduino:mbed_portenta + # - fqbn: arduino:mbed_portenta:envie_m4 + # platforms: | + # - name: arduino:mbed_portenta - fqbn: arduino:mbed_nano:nano33ble platforms: | - name: arduino:mbed_nano From ecb8998c19aaea3fefa11083ee89b593009f1985 Mon Sep 17 00:00:00 2001 From: Mathieu Kaelin Date: Tue, 21 Mar 2023 04:10:56 +0100 Subject: [PATCH 4/4] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c6f7fc..f830652 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Compile Examples](https://github.com/monolithicpower/MagVector-Arduino-Library/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/monolithicpower/MagVector-Arduino-Library/actions/workflows/compile-examples.yml) # MagVector-Arduino-Library Arduino library for the MPS MagVector 3D magnetic sensor. @@ -59,4 +60,4 @@ It is also possible to import the library Zip file (check release tab) from the The library can also be manually installed by copying the MagVector library folder in your arduinosketchfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE to see the library. Check this tutorial on Arduino library installation for more information: -* [All About Arduino Libraries](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use) \ No newline at end of file +* [All About Arduino Libraries](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use)