mirror of
https://github.com/lora-aprs/LoRa_APRS_iGate.git
synced 2025-12-06 07:42:00 +01:00
commit
f1f42038e7
69
.github/workflows/build_check.yml
vendored
69
.github/workflows/build_check.yml
vendored
|
|
@ -3,7 +3,6 @@ name: Integration Tests
|
||||||
on:
|
on:
|
||||||
merge_group:
|
merge_group:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, reopened]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
@ -45,10 +44,10 @@ jobs:
|
||||||
- 'lib/BoardFinder'
|
- 'lib/BoardFinder'
|
||||||
- 'lib/ConfigurationManagement'
|
- 'lib/ConfigurationManagement'
|
||||||
#- 'lib/Display'
|
#- 'lib/Display'
|
||||||
#- 'lib/NTPClient'
|
- 'lib/NTPClient'
|
||||||
- 'lib/PowerManagement'
|
- 'lib/PowerManagement'
|
||||||
- 'lib/System'
|
- 'lib/System'
|
||||||
#- 'lib/TimeLib'
|
- 'lib/TimeLib'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
@ -61,38 +60,14 @@ jobs:
|
||||||
cppcheck:
|
cppcheck:
|
||||||
name: Run cppcheck
|
name: Run cppcheck
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
CPPCHECK_ARGS: --enable=all --std=c++14 --inline-suppr -I lib/BoardFinder -I lib/ConfigurationManagement -I lib/Display -I lib/LoRa -I lib/LoRa_APRS -I lib/NTPClient -I lib/PowerManagement -I lib/System -I lib/TimeLib -i lib/Display -i lib/LoRa -i lib/NTPClient -i lib/TimeLib src lib
|
|
||||||
steps:
|
steps:
|
||||||
- name: checkout code
|
- uses: actions/cache@v3
|
||||||
uses: actions/checkout@v3
|
|
||||||
- run: docker pull facthunder/cppcheck:latest
|
|
||||||
- name: Run cppcheck and print result
|
|
||||||
run: docker run --rm -v ${PWD}:/src facthunder/cppcheck:latest /bin/bash -c "cppcheck $CPPCHECK_ARGS"
|
|
||||||
- name: Run cppcheck and create html
|
|
||||||
run: docker run --rm -v ${PWD}:/src facthunder/cppcheck:latest /bin/bash -c "cppcheck --xml $CPPCHECK_ARGS 2> report.xml && cppcheck-htmlreport --file=report.xml --report-dir=output"
|
|
||||||
- name: Upload report
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: Cppcheck Report
|
|
||||||
path: output
|
|
||||||
|
|
||||||
|
|
||||||
remote_testing:
|
|
||||||
name: Remote Testing
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
env:
|
|
||||||
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }}
|
|
||||||
steps:
|
|
||||||
- name: Setup Cache
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/pip
|
~/.cache/pip
|
||||||
~/.platformio
|
~/.platformio/.cache
|
||||||
key: remote-cache
|
key: check-cache
|
||||||
- name: Setup Python
|
- uses: actions/setup-python@v4
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
- name: Install PlatformIO
|
- name: Install PlatformIO
|
||||||
|
|
@ -101,9 +76,37 @@ jobs:
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install --upgrade platformio
|
pip install --upgrade platformio
|
||||||
|
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Run PlatformIO Check
|
||||||
|
run: pio check --fail-on-defect high -e lora_board
|
||||||
|
|
||||||
|
hw_testing:
|
||||||
|
name: Hardware Testing
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
usb_port: [ttyUSB0]
|
||||||
|
runs-on: [self-hosted, "${{ matrix.usb_port }}"]
|
||||||
|
steps:
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/pip
|
||||||
|
~/.platformio/.cache
|
||||||
|
key: hw-cache
|
||||||
|
- uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.10'
|
||||||
|
- name: Install PlatformIO
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install --upgrade platformio
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: List Devices
|
- name: List Devices
|
||||||
run: pio remote device list
|
run: pio device list
|
||||||
- name: PlatformIO Test
|
- name: PlatformIO Test
|
||||||
run: pio remote test -v -r --upload-port /dev/ttyUSB4 --test-port /dev/ttyUSB4
|
if: always()
|
||||||
|
run: flock -w 600 --verbose /locks/pio-${{ matrix.usb_port }} -c "pio test -vvv --upload-port /dev/${{ matrix.usb_port }} --test-port /dev/${{ matrix.usb_port }}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,8 @@ bool NTPClient::forceUpdate() {
|
||||||
do {
|
do {
|
||||||
delay(10);
|
delay(10);
|
||||||
cb = this->_udp.parsePacket();
|
cb = this->_udp.parsePacket();
|
||||||
if (timeout > 100) return false; // timeout after 1000 ms
|
if (timeout > 100)
|
||||||
|
return false; // timeout after 1000 ms
|
||||||
timeout++;
|
timeout++;
|
||||||
} while (cb == 0);
|
} while (cb == 0);
|
||||||
|
|
||||||
|
|
@ -112,7 +113,8 @@ bool NTPClient::forceUpdate() {
|
||||||
bool NTPClient::update() {
|
bool NTPClient::update() {
|
||||||
if ((millis() - this->_lastUpdate >= this->_updateInterval) // Update after _updateInterval
|
if ((millis() - this->_lastUpdate >= this->_updateInterval) // Update after _updateInterval
|
||||||
|| this->_lastUpdate == 0) { // Update if there was no update yet.
|
|| this->_lastUpdate == 0) { // Update if there was no update yet.
|
||||||
if (!this->_udpSetup || this->_port != NTP_DEFAULT_LOCAL_PORT) this->begin(this->_port); // setup the UDP client if needed
|
if (!this->_udpSetup || this->_port != NTP_DEFAULT_LOCAL_PORT)
|
||||||
|
this->begin(this->_port); // setup the UDP client if needed
|
||||||
return this->forceUpdate();
|
return this->forceUpdate();
|
||||||
}
|
}
|
||||||
return false; // return false if update does not occur
|
return false; // return false if update does not occur
|
||||||
|
|
|
||||||
|
|
@ -135,13 +135,11 @@ int year(time_t t) { // the year for the given time
|
||||||
return tmYearToCalendar(tm.Year);
|
return tmYearToCalendar(tm.Year);
|
||||||
}
|
}
|
||||||
|
|
||||||
const String timeString()
|
const String timeString() {
|
||||||
{
|
|
||||||
return timeString(now());
|
return timeString(now());
|
||||||
}
|
}
|
||||||
|
|
||||||
const String timeString(time_t t)
|
const String timeString(time_t t) {
|
||||||
{
|
|
||||||
char line[30];
|
char line[30];
|
||||||
sprintf(line, "%02d:%02d:%02d", hour(t), minute(t), second(t));
|
sprintf(line, "%02d:%02d:%02d", hour(t), minute(t), second(t));
|
||||||
return String(line);
|
return String(line);
|
||||||
|
|
@ -254,7 +252,6 @@ getExternalTime getTimePtr; // pointer to external sync function
|
||||||
time_t sysUnsyncedTime = 0; // the time sysTime unadjusted by sync
|
time_t sysUnsyncedTime = 0; // the time sysTime unadjusted by sync
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
time_t now() {
|
time_t now() {
|
||||||
// calculate number of seconds passed since last call to now()
|
// calculate number of seconds passed since last call to now()
|
||||||
while (millis() - prevMillis >= 1000) {
|
while (millis() - prevMillis >= 1000) {
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,35 @@
|
||||||
#ifndef _Time_h
|
#ifndef _Time_h
|
||||||
#define _Time_h
|
#define _Time_h
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
typedef enum {timeNotSet, timeNeedsSync, timeSet
|
typedef enum {
|
||||||
|
timeNotSet,
|
||||||
|
timeNeedsSync,
|
||||||
|
timeSet
|
||||||
} timeStatus_t;
|
} timeStatus_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
dowInvalid, dowSunday, dowMonday, dowTuesday, dowWednesday, dowThursday, dowFriday, dowSaturday
|
dowInvalid,
|
||||||
|
dowSunday,
|
||||||
|
dowMonday,
|
||||||
|
dowTuesday,
|
||||||
|
dowWednesday,
|
||||||
|
dowThursday,
|
||||||
|
dowFriday,
|
||||||
|
dowSaturday
|
||||||
} timeDayOfWeek_t;
|
} timeDayOfWeek_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
tmSecond, tmMinute, tmHour, tmWday, tmDay,tmMonth, tmYear, tmNbrFields
|
tmSecond,
|
||||||
|
tmMinute,
|
||||||
|
tmHour,
|
||||||
|
tmWday,
|
||||||
|
tmDay,
|
||||||
|
tmMonth,
|
||||||
|
tmYear,
|
||||||
|
tmNbrFields
|
||||||
} tmByteFields;
|
} tmByteFields;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -43,7 +60,6 @@ typedef struct {
|
||||||
typedef time_t (*getExternalTime)();
|
typedef time_t (*getExternalTime)();
|
||||||
// typedef void (*setExternalTime)(const time_t); // not used in this version
|
// typedef void (*setExternalTime)(const time_t); // not used in this version
|
||||||
|
|
||||||
|
|
||||||
/*==============================================================================*/
|
/*==============================================================================*/
|
||||||
/* Useful Constants */
|
/* Useful Constants */
|
||||||
#define SECS_PER_MIN ((time_t)(60UL))
|
#define SECS_PER_MIN ((time_t)(60UL))
|
||||||
|
|
@ -69,7 +85,6 @@ typedef time_t(*getExternalTime)();
|
||||||
#define previousSunday(_time_) ((_time_)-elapsedSecsThisWeek(_time_)) // time at the start of the week for the given time
|
#define previousSunday(_time_) ((_time_)-elapsedSecsThisWeek(_time_)) // time at the start of the week for the given time
|
||||||
#define nextSunday(_time_) (previousSunday(_time_) + SECS_PER_WEEK) // time at the end of the week for the given time
|
#define nextSunday(_time_) (previousSunday(_time_) + SECS_PER_WEEK) // time at the end of the week for the given time
|
||||||
|
|
||||||
|
|
||||||
/* Useful Macros for converting elapsed time to a time_t */
|
/* Useful Macros for converting elapsed time to a time_t */
|
||||||
#define minutesToTime_t(M) ((M)*SECS_PER_MIN)
|
#define minutesToTime_t(M) ((M)*SECS_PER_MIN)
|
||||||
#define hoursToTime_t(H) ((H)*SECS_PER_HOUR)
|
#define hoursToTime_t(H) ((H)*SECS_PER_HOUR)
|
||||||
|
|
@ -124,4 +139,3 @@ void breakTime(time_t time, tmElements_t &tm); // break time_t into elements
|
||||||
time_t makeTime(const tmElements_t &tm); // convert time elements into time_t
|
time_t makeTime(const tmElements_t &tm); // convert time elements into time_t
|
||||||
|
|
||||||
#endif /* _Time_h */
|
#endif /* _Time_h */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,48 +9,29 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Arduino.h>
|
|
||||||
#include "TimeLib.h"
|
#include "TimeLib.h"
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
const String monthNames[] =
|
const String monthNames[] = {"Error", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
|
||||||
{
|
|
||||||
"Error", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
|
|
||||||
};
|
|
||||||
|
|
||||||
const String monthStr(uint8_t month)
|
const String monthStr(uint8_t month) {
|
||||||
{
|
|
||||||
return monthNames[month];
|
return monthNames[month];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const String monthShortNames[] = {"Err", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||||
|
|
||||||
const String monthShortNames[] =
|
const String monthShortStr(uint8_t month) {
|
||||||
{
|
|
||||||
"Err", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
|
||||||
};
|
|
||||||
|
|
||||||
const String monthShortStr(uint8_t month)
|
|
||||||
{
|
|
||||||
return monthShortNames[month];
|
return monthShortNames[month];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const String dayNames[] = {"Err", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
|
||||||
|
|
||||||
const String dayNames[] =
|
const String dayStr(uint8_t day) {
|
||||||
{
|
|
||||||
"Err", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
|
||||||
};
|
|
||||||
|
|
||||||
const String dayStr(uint8_t day)
|
|
||||||
{
|
|
||||||
return dayNames[day];
|
return dayNames[day];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const String dayShortNames[] = {"Err", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||||
|
|
||||||
const String dayShortNames[] =
|
const String dayShortStr(uint8_t day) {
|
||||||
{
|
|
||||||
"Err", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
|
||||||
};
|
|
||||||
|
|
||||||
const String dayShortStr(uint8_t day)
|
|
||||||
{
|
|
||||||
return dayShortNames[day];
|
return dayShortNames[day];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,9 @@ lib_deps =
|
||||||
jgromes/RadioLib @ 5.7.0
|
jgromes/RadioLib @ 5.7.0
|
||||||
check_tool = cppcheck
|
check_tool = cppcheck
|
||||||
check_flags =
|
check_flags =
|
||||||
cppcheck: --suppress=*:*.pio\* --inline-suppr -DCPPCHECK --force lib -ilib/TimeLib -ilib/LoRa -ilib/NTPClient
|
cppcheck: --std=c++14 --suppress=*:*.pio\* --inline-suppr --suppress=unusedFunction -DCPPCHECK --force lib -ilib/TimeLib
|
||||||
check_skip_packages = yes
|
check_skip_packages = yes
|
||||||
test_build_src = yes
|
test_build_src = yes
|
||||||
#monitor_flags = --raw
|
|
||||||
# activate for OTA Update, use the CALLSIGN from is-cfg.json as upload_port:
|
# activate for OTA Update, use the CALLSIGN from is-cfg.json as upload_port:
|
||||||
#upload_protocol = espota
|
#upload_protocol = espota
|
||||||
#upload_port = <CALLSIGN>.local
|
#upload_port = <CALLSIGN>.local
|
||||||
|
|
@ -35,4 +34,4 @@ build_flags = -Werror -Wall -DUNITY_INCLUDE_PRINT_FORMATTED
|
||||||
board = esp32doit-devkit-v1
|
board = esp32doit-devkit-v1
|
||||||
build_flags = -Werror -Wall -DCORE_DEBUG_LEVEL=5 -DUNITY_INCLUDE_PRINT_FORMATTED
|
build_flags = -Werror -Wall -DCORE_DEBUG_LEVEL=5 -DUNITY_INCLUDE_PRINT_FORMATTED
|
||||||
build_type = debug
|
build_type = debug
|
||||||
monitor_filters = esp32_exception_decoder
|
#monitor_filters = esp32_exception_decoder
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue