Merge branch 'master' into tinyusb-refactor

This commit is contained in:
hathach committed 2019-12-20 15:36:42 +07:00
commit 1e0cee1271
9 files changed
+96 -27

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
---
name: Bug report
about: Create a report to help us improve
title: "[Bug]"
title: ''
labels: Bug
assignees: ''
+1 -1
View File
@@ -1,7 +1,7 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[Feature]"
title: ''
labels: Feature
assignees: ''
@@ -2,7 +2,7 @@
name: Questions please use our forum support
about: Don't open issue, post your question at forums.adafruit.com
title: ''
labels: ''
labels: wontfix
assignees: ''
---
+27 -4
View File
@@ -1,3 +1,4 @@
sudo: required
language: c
dist: xenial
git:
@@ -8,10 +9,28 @@ env:
global:
- BSP_PATH="$HOME/.arduino15/packages/adafruit/hardware/nrf52"
jobs:
# Split into one job per board (aka variant)
- VARIANT="feather52840"
- VARIANT="cplaynrf52840"
- VARIANT="feather52832"
# empty env required, else allow_failures will SILENTY IGNORE matching against env...
-
jobs:
fast_finish: true
include:
- name: "Feather 52840"
env: VARIANT="feather52840"
- name: "Feather 52840 (All warnings)"
env: ALL_WARNINGS="true" VARIANT="feather52840"
- name: "Circuit Playground 52840"
env: VARIANT="cplaynrf52840"
- name: "Circuit Playground 52840 (All warnings)"
env: ALL_WARNINGS="true" VARIANT="cplaynrf52840"
- name: "Feather 52832"
env: VARIANT="feather52832"
- name: "Feather 52832 (All warnings)"
env: ALL_WARNINGS="true" VARIANT="feather52832"
allow_failures:
- env: ALL_WARNINGS="true" VARIANT="feather52840"
- env: ALL_WARNINGS="true" VARIANT="cplaynrf52840"
- env: ALL_WARNINGS="true" VARIANT="feather52832"
addons:
apt:
@@ -24,6 +43,10 @@ addons:
confinement: classic
install:
# Filter only mDNS / Bonjour traffic
- sudo iptables --insert INPUT --jump DROP --protocol udp --dport 5353 -m comment --comment "silently drop all 5353/udp input"
- sudo iptables --insert INPUT --jump DROP --destination 224.0.0.251 -m comment --comment "silently drop all mDNS ipv4 broadcast"
# Install the nRF52 support files for arduino
- pip3 install --user adafruit-nrfutil
- umake electronics arduino $HOME/arduino_ide
- export PATH=$HOME/arduino_ide:$PATH
@@ -133,6 +133,7 @@ void disconnect_callback(uint16_t conn_handle, uint8_t reason)
void bleuart_rx_callback(BLEClientUart& uart_svc)
{
int count = uart_svc.available();
(void)count;
uart_svc.flush();
}
@@ -167,9 +167,6 @@ void connect_callback(uint16_t conn_handle)
Serial.print("Connect Callback, conn_handle: ");
Serial.println( conn_handle );
/* Complete Local Name */
uint8_t buffer[BLE_GAP_ADV_SET_DATA_SIZE_MAX] = { 0 };
// If Service is not found, disconnect and return
Serial.print("Discovering Optical Service ... ");
if ( !sensorTagOpticalService.discover(conn_handle) )
@@ -28,7 +28,7 @@ BLEMidi blemidi;
MIDI_CREATE_BLE_INSTANCE(blemidi);
// Variable that holds the current position in the sequence.
int position = 0;
unsigned int position = 0;
// Store example melody as an array of note values
byte note_sequence[] = {
@@ -137,14 +137,10 @@ void loop()
// Setup variables for the current and previous
// positions in the note sequence.
int current = position;
int previous = position - 1;
unsigned int current = position;
// If we currently are at position 0, set the
// previous position to the last note in the sequence.
if (previous < 0) {
previous = sizeof(note_sequence) - 1;
}
unsigned int previous = (current == 0) ? (sizeof(note_sequence)-1) : current - 1;
// Send Note On for current position at full velocity (127) on channel 1.
MIDI.sendNoteOn(note_sequence[current], 127, 1);
@@ -128,10 +128,10 @@ BLEUuid uuid = BLEUuid(CUSTOM_UUID);
/* This struct is used to track detected nodes */
typedef struct node_record_s
{
uint8_t addr[6]; // Six byte device address
int8_t rssi; // RSSI value
int32_t timestamp; // Timestamp for invalidation purposes
int8_t reserved; // Padding for word alignment
uint8_t addr[6]; // Six byte device address
int8_t rssi; // RSSI value
uint32_t timestamp; // Timestamp for invalidation purposes
int8_t reserved; // Padding for word alignment
} node_record_t;
node_record_t records[ARRAY_SIZE];
@@ -530,7 +530,7 @@ int invalidateRecords(void)
{
if (records[i].timestamp) // Ignore zero"ed records
{
if (records[i].timestamp <= millis() - TIMEOUT_MS)
if (millis() - records[i].timestamp >= TIMEOUT_MS)
{
/* Record has expired, zero it out */
memset(&records[i], 0, sizeof(node_record_t));
+57 -5
View File
@@ -8,6 +8,13 @@ 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
@@ -21,6 +28,25 @@ variants_dict = {
'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
@@ -33,6 +59,10 @@ def build_examples(variant):
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()
@@ -40,11 +70,28 @@ def build_examples(variant):
if os.path.exists(os.path.dirname(sketch) + '/.skip') or os.path.exists(os.path.dirname(sketch) + '/.skip.' + variant):
success = "skipped"
else:
build_result = subprocess.run("arduino --verify {}".format(sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
# 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
@@ -56,8 +103,14 @@ def build_examples(variant):
print((build_format + '| {:5.2f}s |').format(sketch.split(os.path.sep)[1], os.path.basename(sketch), success, build_duration))
if build_result.returncode != 0:
print(build_result.stdout.decode("utf-8"))
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))
@@ -65,7 +118,6 @@ def build_examples(variant):
build_time = time.monotonic()
ENV_VARIABLE_NAME = 'VARIANT'
# build only one variant if the environment variable is specified
if (ENV_VARIABLE_NAME in os.environ):
@@ -74,7 +126,7 @@ if (ENV_VARIABLE_NAME in os.environ):
if (variant in variants_dict):
build_examples(variant)
else:
print('\033[31failed\033[0m - invalid variant name "{}"'.format(variant))
print('\033[31INTERNAL ERR\033[0m - invalid variant name "{}"'.format(variant))
fail_count += 1
exit_status = -1