Pārlūkot izejas kodu

add run-cl-arduino.yml

ackPeng 1 gadu atpakaļ
vecāks
revīzija
e0c377cb6b
3 mainītis faili ar 59 papildinājumiem un 4 dzēšanām
  1. 55 0
      .github/workflows/run-cl-arduino.yml
  2. 3 3
      ITG3200.cpp
  3. 1 1
      ITG3200.h

+ 55 - 0
.github/workflows/run-cl-arduino.yml

@@ -0,0 +1,55 @@
+name: Run Ci Arduino
+
+on:
+  push:
+  pull_request:
+  repository_dispatch:
+    types: [trigger-workflow]
+
+jobs:
+  ci-arduino:
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+
+      - name: Checkout script repository
+        uses: actions/checkout@v4
+        with:
+            repository: Seeed-Studio/ci-arduino
+            path: ci
+
+
+      - name: Setup arduino cli
+        uses: arduino/setup-arduino-cli@v2.0.0
+
+      - name: Create a depend.list file
+        run: |
+          # eg: echo "<repo>" >> depend.list
+
+
+
+          
+
+
+      - name: Create a ignore.list file
+        run: |
+          # eg: echo "<path>,<fqbn>" >> ignore.list
+
+
+      - name: Build sketch
+        run: ./ci/tools/compile.sh
+
+      - name: Build result
+        run: |
+            cat build.log
+            if [ ${{ github.event_name }} == 'pull_request' ] && [ -f compile.failed ]; then
+                exit 1
+            fi
+
+      - name: Generate issue
+        if: ${{ github.event_name != 'pull_request' }}
+        run: ./ci/tools/issue.sh
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

+ 3 - 3
ITG3200.cpp

@@ -92,14 +92,14 @@ double ITG3200::getTemperature() {
 }
 /*Function: Get the contents of the registers in the ITG3200*/
 /*          so as to calculate the angular velocity.        */
-void ITG3200::getXYZ(int* x, int* y, int* z) {
+void ITG3200::getXYZ(int16_t* x, int16_t* y, int16_t* z) {
     *x = read(ITG3200_GX_H, ITG3200_GX_L) + x_offset;
     *y = read(ITG3200_GY_H, ITG3200_GY_L) + y_offset;
     *z = read(ITG3200_GZ_H, ITG3200_GZ_L) + z_offset;
 }
 /*Function: Get the angular velocity and its unit is degree per second.*/
 void ITG3200::getAngularVelocity(float* ax, float* ay, float* az) {
-    int x, y, z;
+    int16_t x, y, z;
     getXYZ(&x, &y, &z);
     *ax = x / 14.375;
     *ay = y / 14.375;
@@ -109,7 +109,7 @@ void ITG3200::zeroCalibrate(unsigned int samples, unsigned int sampleDelayMS) {
     long x_offset_temp = 0;
     long y_offset_temp = 0;
     long z_offset_temp = 0;
-    long x, y, z;
+    int16_t x, y, z;
     x_offset = 0;
     y_offset = 0;
     z_offset = 0;

+ 1 - 1
ITG3200.h

@@ -54,7 +54,7 @@ class ITG3200 {
     int16_t read(uint8_t addressh, uint8_t addressl);
     void write(uint8_t _register, uint8_t _data);
     double getTemperature();
-    void getXYZ(int* x, int* y, int* z);
+    void getXYZ(int16_t* x, int16_t* y, int16_t* z);
     void getAngularVelocity(float* ax, float* ay, float* az);
     void zeroCalibrate(unsigned int samples, unsigned int sampleDelayMS);
 };