diff --git a/.github/workflows/githubci.yml b/.github/workflows/githubci.yml index ab86777e4..dce1d02a7 100644 --- a/.github/workflows/githubci.yml +++ b/.github/workflows/githubci.yml @@ -47,15 +47,24 @@ jobs: arduino-cli core update-index arduino-cli core update-index --additional-urls $BSP_URL arduino-cli core install adafruit:nrf52 --additional-urls $BSP_URL + # Repalce release BSP with our code BSP_VERSION=`eval ls $HOME/$BSP_PATH` rm -r $HOME/$BSP_PATH/* ln -s $GITHUB_WORKSPACE $HOME/$BSP_PATH/$BSP_VERSION + # Install library dependency - arduino-cli lib install "Adafruit AHRS" "Adafruit APDS9960 Library" "Adafruit BMP280 Library" "Adafruit Circuit Playground" "Adafruit EPD" "Adafruit GFX Library" "Adafruit HX8357 Library" "Adafruit ILI9341" "Adafruit LIS3MDL" "Adafruit LSM6DS" "Adafruit NeoPixel" "Adafruit NeoMatrix" "Adafruit Sensor Calibration" "Adafruit SHT31 Library" "Adafruit SSD1306" "Adafruit ST7735 and ST7789 Library" "Firmata" "SdFat - Adafruit Fork" - + arduino-cli lib install "Adafruit AHRS" "Adafruit APDS9960 Library" "Adafruit BMP280 Library" "Adafruit Circuit Playground" "Adafruit EPD" "Adafruit GFX Library" "Adafruit HX8357 Library" "Adafruit ILI9341" "Adafruit LIS3MDL" "Adafruit LSM6DS" "Adafruit NeoPixel" "Adafruit NeoMatrix" "Adafruit Sensor Calibration" "Adafruit SHT31 Library" "Adafruit SSD1306" "Adafruit ST7735 and ST7789 Library" "SdFat - Adafruit Fork" + # TODO update to support MIDI version 5 later on arduino-cli lib install "MIDI Library"@4.3.1 + # TODO use firmata master to prevent build error with gcc v9 (should be remove after 2.5.9 is released) + # https://github.com/firmata/arduino/pull/438 + git clone --depth 1 https://github.com/firmata/arduino.git $HOME/Arduino/libraries/firmata + + # Library summary + arduino-cli lib list + - name: Build examples run: python3 tools/build_all.py ${{ matrix.arduino-platform }} diff --git a/libraries/BLEAdafruitService/src/services/BLEAdafruitSensor.cpp b/libraries/BLEAdafruitService/src/services/BLEAdafruitSensor.cpp index be3b7a865..d4e06df37 100644 --- a/libraries/BLEAdafruitService/src/services/BLEAdafruitSensor.cpp +++ b/libraries/BLEAdafruitService/src/services/BLEAdafruitSensor.cpp @@ -36,7 +36,7 @@ BLEAdafruitSensor::BLEAdafruitSensor(BLEUuid service_uuid, BLEUuid data_uuid) _notify_cb = NULL; } -err_t BLEAdafruitSensor::_begin(int32_t ms) +err_t BLEAdafruitSensor::_begin(int ms) { // Invoke base class begin() VERIFY_STATUS( BLEService::begin() ); @@ -59,19 +59,19 @@ err_t BLEAdafruitSensor::_begin(int32_t ms) return ERROR_NONE; } -err_t BLEAdafruitSensor::begin(measure_callback_t fp, int32_t ms) +err_t BLEAdafruitSensor::begin(measure_callback_t fp, int ms) { _measure_cb = fp; return _begin(ms); } -err_t BLEAdafruitSensor::begin(Adafruit_Sensor* sensor, int32_t ms) +err_t BLEAdafruitSensor::begin(Adafruit_Sensor* sensor, int ms) { _sensor = sensor; return _begin(ms); } -void BLEAdafruitSensor::setPeriod(int32_t period_ms) +void BLEAdafruitSensor::setPeriod(int period_ms) { _period.write32(period_ms); _update_timer(period_ms); diff --git a/libraries/BLEAdafruitService/src/services/BLEAdafruitSensor.h b/libraries/BLEAdafruitService/src/services/BLEAdafruitSensor.h index e70032865..a934508b2 100644 --- a/libraries/BLEAdafruitService/src/services/BLEAdafruitSensor.h +++ b/libraries/BLEAdafruitService/src/services/BLEAdafruitSensor.h @@ -30,17 +30,17 @@ class BLEAdafruitSensor : public BLEService { public: - static const int32_t DEFAULT_PERIOD = 1000; + static const int DEFAULT_PERIOD = 1000; typedef void (*notify_callback_t)(uint16_t conn_hdl, bool enabled); typedef uint16_t (*measure_callback_t )(uint8_t* buf, uint16_t bufsize); BLEAdafruitSensor(BLEUuid service_uuid, BLEUuid data_uuid); - virtual err_t begin(measure_callback_t fp, int32_t ms = DEFAULT_PERIOD); - virtual err_t begin(Adafruit_Sensor* sensor, int32_t ms = DEFAULT_PERIOD); + virtual err_t begin(measure_callback_t fp, int ms = DEFAULT_PERIOD); + virtual err_t begin(Adafruit_Sensor* sensor, int ms = DEFAULT_PERIOD); - void setPeriod(int32_t period_ms); + void setPeriod(int period_ms); void setNotifyCallback(notify_callback_t fp); protected: @@ -54,7 +54,7 @@ class BLEAdafruitSensor : public BLEService SoftwareTimer _timer; - err_t _begin(int32_t ms); + err_t _begin(int ms); virtual void _update_timer(int32_t ms); virtual void _measure_handler(void); diff --git a/libraries/Bluefruit52Lib/src/BLECharacteristic.cpp b/libraries/Bluefruit52Lib/src/BLECharacteristic.cpp index 338fb84c5..e38f2796f 100644 --- a/libraries/Bluefruit52Lib/src/BLECharacteristic.cpp +++ b/libraries/Bluefruit52Lib/src/BLECharacteristic.cpp @@ -564,11 +564,6 @@ uint16_t BLECharacteristic::write32(int num) return write32( (uint32_t) num ); } -uint16_t BLECharacteristic::write32(int32_t num) -{ - return write32( (uint32_t) num ); -} - /*------------------------------------------------------------------*/ /* READ *------------------------------------------------------------------*/ diff --git a/libraries/Bluefruit52Lib/src/BLECharacteristic.h b/libraries/Bluefruit52Lib/src/BLECharacteristic.h index 992001fee..d0ca796ad 100644 --- a/libraries/Bluefruit52Lib/src/BLECharacteristic.h +++ b/libraries/Bluefruit52Lib/src/BLECharacteristic.h @@ -129,7 +129,6 @@ class BLECharacteristic uint16_t write16 (uint16_t num); uint16_t write32 (uint32_t num); uint16_t write32 (int num); - uint16_t write32 (int32_t num); /*------------- Read -------------*/ uint16_t read (void* buffer, uint16_t bufsize, uint16_t offset = 0); diff --git a/tools/build_all_travis.py b/tools/build_all_travis.py deleted file mode 100644 index 0b01f55f9..000000000 --- a/tools/build_all_travis.py +++ /dev/null @@ -1,149 +0,0 @@ -import os -import glob -import sys -import subprocess -import time - -travis = False -if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true": - travis = True - -all_warnings = False -if "ALL_WARNINGS" in os.environ and os.environ["ALL_WARNINGS"] == "true": - all_warnings = True - -ENV_VARIABLE_NAME = 'VARIANT' - - -exit_status = 0 -success_count = 0 -fail_count = 0 - -build_format = '| {:20} | {:30} | {:9} ' -build_separator = '-' * 78 - -variants_dict = { - 'feather52840': 'Feather nRF52840 Express', - 'cplaynrf52840': 'Circuit Playground Bluefruit Express', - 'itsybitsy52840': 'ItsyBitsy nRF52840 Express', - 'cluenrf52840': 'Clue nRF52840', - 'feather52832': 'Feather nRF52832' -} - -# STDERR receives output that starts with the following text, none of which should be considered a warning or error... -output_to_ignore = ( - 'Picked up JAVA_TOOL_OPTIONS:', - 'Loading configuration...', - 'Initializing packages...', - 'Preparing boards...', - 'Verifying...', -) - -def errorOutputFilter(line): - if len(line) == 0: - return False - if line.isspace(): # Note: empty string does not match here! - return False - if line.startswith(output_to_ignore): # alternatively, can trim() each line, but that would create lots of short-lived strings... - return False - # TODO: additional items to remove? - return True - - -def build_examples(variant): - global exit_status, success_count, fail_count, build_format, build_separator - - print('\n') - print(build_separator) - print('| {:^74} |'.format(variants_dict[variant])) - print(build_separator) - print((build_format + '| {:6} |').format('Library', 'Example', 'Result', 'Time')) - print(build_separator) - subprocess.run("arduino --board adafruit:nrf52:{}:softdevice={},debug=l0 --save-prefs".format(variant, 's140v6' if variant != 'feather52832' else 's132v6'), shell=True, - stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - - if all_warnings: - subprocess.run("arduino --pref 'compiler.warning_level=all' --save-prefs", shell=True, - stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - - for sketch in glob.iglob('libraries/**/*.ino', recursive=True): - start_time = time.monotonic() - - # skip if example contains: ".skip" or ".skip.variant" - # however ".build.variant" file can overwrite ".skip", used to build a specific variant only - sketchdir = os.path.dirname(sketch) - if ( (os.path.exists(sketchdir + '/.skip') or os.path.exists(sketchdir + '/.skip.' + variant)) and - not os.path.exists(sketchdir + '/.build.' + variant)): - success = "skipped" - else: - # TODO - preferably, would have STDERR show up in **both** STDOUT and STDERR. - # preferably, would use Python logging handler to get both distinct outputs and one merged output - # for now, split STDERR when building with all warnings enabled, so can detect warning/error output. - if all_warnings: - build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - else: - build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - - # get stderr into a form where len(warningLines) indicates a true warning was output to stderr - warningLines = []; - if all_warnings and build_result.stderr: - tmpWarningLines = build_result.stderr.decode("utf-8").splitlines() - warningLines = list(filter(errorOutputFilter, (tmpWarningLines))) - - if build_result.returncode != 0: - exit_status = build_result.returncode - success = "\033[31mfailed\033[0m " - fail_count += 1 - elif len(warningLines) != 0: - exit_status = -1 - success = "\033[31mwarnings\033[0m " - fail_count += 1 - else: - success = "\033[32msucceeded\033[0m" - success_count += 1 - - build_duration = time.monotonic() - start_time - - if travis: - print('travis_fold:start:build-{}\\r'.format(sketch)) - - print((build_format + '| {:5.2f}s |').format(sketch.split(os.path.sep)[1], os.path.basename(sketch), success, build_duration)) - - if success != "skipped": - if build_result.returncode != 0: - print(build_result.stdout.decode("utf-8")) - if (build_result.stderr): - print(build_result.stderr.decode("utf-8")) - if len(warningLines) != 0: - for line in warningLines: - print(line) - - if travis: - print('travis_fold:end:build-{}\\r'.format(sketch)) - - -build_time = time.monotonic() - - -# build only one variant if the environment variable is specified -if (ENV_VARIABLE_NAME in os.environ): - variant = os.environ.get(ENV_VARIABLE_NAME) - # only use the environment variable if the variant exists in the dictionary - if (variant in variants_dict): - build_examples(variant) - else: - print('\033[31INTERNAL ERR\033[0m - invalid variant name "{}"'.format(variant)) - fail_count += 1 - exit_status = -1 - -else: # no environment variable specified, so build all variants - for var in variants_dict: - build_examples(var) - - -print(build_separator) -build_time = time.monotonic() - build_time -print("Build Summary: {} \033[32msucceeded\033[0m, {} \033[31mfailed\033[0m and took {:.2f}s".format(success_count, fail_count, build_time)) -print(build_separator) - -sys.exit(exit_status)