Skip to content

Commit

Permalink
update build-CI, badges, issue 28 (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart authored Oct 20, 2021
1 parent 11292be commit 659140e
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 16 deletions.
10 changes: 7 additions & 3 deletions .arduino-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
- leonardo
- due
- zero
# - due
# - zero
# - leonardo
- m4
- esp32
# - esp8266
# - mega2560
10 changes: 7 additions & 3 deletions .github/workflows/arduino_test_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ name: Arduino CI
on: [push, pull_request]

jobs:
arduino_ci:
runTest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: Arduino-CI/action@master
# Arduino-CI/[email protected]
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- run: |
gem install arduino_ci
arduino_ci.rb
13 changes: 11 additions & 2 deletions GY521.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
// 0.3.2 2021-07-05 fix #20 support multiWire
// 0.3.3 2021-07-05 fix #22 improve maths
// 0.3.4 2021-07-12 fix #24 improve precision
// 0.3.5 2021-10-20 update build-CI, badges + #28 add wakeup to begin().


#include "GY521.h"
Expand Down Expand Up @@ -52,15 +53,23 @@ GY521::GY521(uint8_t address, TwoWire *wire)
bool GY521::begin(uint8_t sda, uint8_t scl)
{
_wire->begin(sda, scl);
return isConnected();
if (isConnected())
{
return wakeup();
}
return false;
}
#endif


bool GY521::begin()
{
_wire->begin();
return isConnected();
if (isConnected())
{
return wakeup();
}
return false;
}


Expand Down
2 changes: 1 addition & 1 deletion GY521.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "Wire.h"


#define GY521_LIB_VERSION (F("0.3.4"))
#define GY521_LIB_VERSION (F("0.3.5"))


#ifndef GY521_THROTTLE_TIME
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

[![Arduino CI](https://github.com/RobTillaart/GY521/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![Arduino-lint](https://github.com/RobTillaart/GY521/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/GY521/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/GY521/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/GY521/actions/workflows/jsoncheck.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/GY521/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/GY521.svg?maxAge=3600)](https://github.com/RobTillaart/GY521/releases)

Expand Down
7 changes: 6 additions & 1 deletion examples/GY521_pitch_roll_yaw/GY521_pitch_roll_yaw.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
// PURPOSE: demo PRY
// DATE: 2020-08-06


#include "GY521.h"

GY521 sensor(0x69);

uint32_t counter = 0;


void setup()
{
Serial.begin(115200);
Expand All @@ -31,7 +33,7 @@ void setup()
sensor.setThrottle();
Serial.println("start...");

// set callibration values from calibration sketch.
// set calibration values from calibration sketch.
sensor.axe = 0;
sensor.aye = 0;
sensor.aze = 0;
Expand All @@ -40,6 +42,7 @@ void setup()
sensor.gze = 0;
}


void loop()
{
sensor.read();
Expand All @@ -64,4 +67,6 @@ void loop()
counter++;
}


// -- END OF FILE --

7 changes: 6 additions & 1 deletion examples/readCalibration/readCalibration.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// PURPOSE: read the calibration values / errors for a flat sensor.
// DATE: 2020-07-14


#include "GY521.h"

GY521 sensor(0x69);
Expand All @@ -15,6 +16,7 @@ float ax, ay, az;
float gx, gy, gz;
float t;


void setup()
{
Serial.begin(115200);
Expand All @@ -31,7 +33,7 @@ void setup()
sensor.setGyroSensitivity(0); // 250 degrees/s
sensor.setThrottle(false);

// set all callibration errors to zero
// set all calibration errors to zero
sensor.axe = 0;
sensor.aye = 0;
sensor.aze = 0;
Expand All @@ -42,6 +44,7 @@ void setup()
Serial.println("\n\nReading calibration numbers...");
}


void loop()
{
ax = ay = az = 0;
Expand Down Expand Up @@ -107,4 +110,6 @@ void loop()
delay(100);
}


// -- END OF FILE --

6 changes: 5 additions & 1 deletion examples/test1/test1.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
// PURPOSE: minimal demo
// DATE: 2020-07-01


#include "GY521.h"

GY521 sensor(0x69);

uint32_t counter = 0;


void setup()
{
Serial.begin(115200);
Expand All @@ -31,7 +33,7 @@ void setup()
sensor.setThrottle();
Serial.println("start...");

// set callibration values from calibration sketch.
// set calibration values from calibration sketch.
sensor.axe = 0;
sensor.aye = 0;
sensor.aze = 0;
Expand Down Expand Up @@ -78,4 +80,6 @@ void loop()
delay(1000);
}


// -- END OF FILE --

5 changes: 5 additions & 0 deletions examples/test_2/test_2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
// PURPOSE: test set/get
// DATE: 2020-08-06


#include "GY521.h"

GY521 sensor(0x69);


void setup()
{
Serial.begin(115200);
Expand Down Expand Up @@ -75,8 +77,11 @@ void setup()
Serial.println("\nDone...");
}


void loop()
{
}


// -- END OF FILE --

2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/GY521.git"
},
"version": "0.3.4",
"version": "0.3.5",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=GY521
version=0.3.4
version=0.3.5
author=Rob Tillaart <[email protected]>
maintainer=Rob Tillaart <[email protected]>
sentence=Arduino library for GY521 angle measurement
Expand Down
6 changes: 4 additions & 2 deletions test/unit_test_001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// assertNull(actual)
// assertNotNull(actual)


#include <ArduinoUnitTests.h>


Expand All @@ -32,6 +33,7 @@ unittest_setup()
{
}


unittest_teardown()
{
}
Expand All @@ -40,7 +42,7 @@ unittest_teardown()
unittest(test_constructor)
{
GY521 sensor(0x69);
fprintf(stderr, "VERSION: %s\n", GY521_LIB_VERSION);
fprintf(stderr, "VERSION: %s\n", (char *) GY521_LIB_VERSION);
sensor.begin();
assertEqual(GY521_OK, sensor.getError());

Expand Down Expand Up @@ -95,7 +97,7 @@ unittest(test_get_set_sensitivity)

unittest(test_constants)
{
fprintf(stderr, "VERSION: %s\n", GY521_LIB_VERSION);
fprintf(stderr, "VERSION: %s\n", (char *) GY521_LIB_VERSION);

assertEqual(GY521_OK, 0);
assertEqual(GY521_THROTTLED, 1);
Expand Down

0 comments on commit 659140e

Please sign in to comment.