kopia lustrzana https://github.com/lora-aprs/LoRa_APRS_iGate
commit
f1f42038e7
|
@ -3,7 +3,6 @@ name: Integration Tests
|
|||
on:
|
||||
merge_group:
|
||||
pull_request:
|
||||
types: [opened, reopened]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -45,10 +44,10 @@ jobs:
|
|||
- 'lib/BoardFinder'
|
||||
- 'lib/ConfigurationManagement'
|
||||
#- 'lib/Display'
|
||||
#- 'lib/NTPClient'
|
||||
- 'lib/NTPClient'
|
||||
- 'lib/PowerManagement'
|
||||
- 'lib/System'
|
||||
#- 'lib/TimeLib'
|
||||
- 'lib/TimeLib'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
@ -61,38 +60,14 @@ jobs:
|
|||
cppcheck:
|
||||
name: Run cppcheck
|
||||
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:
|
||||
- name: checkout code
|
||||
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
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pip
|
||||
~/.platformio
|
||||
key: remote-cache
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
~/.platformio/.cache
|
||||
key: check-cache
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Install PlatformIO
|
||||
|
@ -101,9 +76,37 @@ jobs:
|
|||
python -m pip install --upgrade pip
|
||||
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
|
||||
uses: actions/checkout@v3
|
||||
- name: List Devices
|
||||
run: pio remote device list
|
||||
run: pio device list
|
||||
- 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 {
|
||||
delay(10);
|
||||
cb = this->_udp.parsePacket();
|
||||
if (timeout > 100) return false; // timeout after 1000 ms
|
||||
if (timeout > 100)
|
||||
return false; // timeout after 1000 ms
|
||||
timeout++;
|
||||
} while (cb == 0);
|
||||
|
||||
|
@ -112,7 +113,8 @@ bool NTPClient::forceUpdate() {
|
|||
bool NTPClient::update() {
|
||||
if ((millis() - this->_lastUpdate >= this->_updateInterval) // Update after _updateInterval
|
||||
|| 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 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);
|
||||
}
|
||||
|
||||
const String timeString()
|
||||
{
|
||||
const String timeString() {
|
||||
return timeString(now());
|
||||
}
|
||||
|
||||
const String timeString(time_t t)
|
||||
{
|
||||
const String timeString(time_t t) {
|
||||
char line[30];
|
||||
sprintf(line, "%02d:%02d:%02d", hour(t), minute(t), second(t));
|
||||
return String(line);
|
||||
|
@ -254,7 +252,6 @@ getExternalTime getTimePtr; // pointer to external sync function
|
|||
time_t sysUnsyncedTime = 0; // the time sysTime unadjusted by sync
|
||||
#endif
|
||||
|
||||
|
||||
time_t now() {
|
||||
// calculate number of seconds passed since last call to now()
|
||||
while (millis() - prevMillis >= 1000) {
|
||||
|
|
|
@ -10,18 +10,35 @@
|
|||
#ifndef _Time_h
|
||||
#define _Time_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <Arduino.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef enum {timeNotSet, timeNeedsSync, timeSet
|
||||
typedef enum {
|
||||
timeNotSet,
|
||||
timeNeedsSync,
|
||||
timeSet
|
||||
} timeStatus_t;
|
||||
|
||||
typedef enum {
|
||||
dowInvalid, dowSunday, dowMonday, dowTuesday, dowWednesday, dowThursday, dowFriday, dowSaturday
|
||||
dowInvalid,
|
||||
dowSunday,
|
||||
dowMonday,
|
||||
dowTuesday,
|
||||
dowWednesday,
|
||||
dowThursday,
|
||||
dowFriday,
|
||||
dowSaturday
|
||||
} timeDayOfWeek_t;
|
||||
|
||||
typedef enum {
|
||||
tmSecond, tmMinute, tmHour, tmWday, tmDay,tmMonth, tmYear, tmNbrFields
|
||||
tmSecond,
|
||||
tmMinute,
|
||||
tmHour,
|
||||
tmWday,
|
||||
tmDay,
|
||||
tmMonth,
|
||||
tmYear,
|
||||
tmNbrFields
|
||||
} tmByteFields;
|
||||
|
||||
typedef struct {
|
||||
|
@ -43,7 +60,6 @@ typedef struct {
|
|||
typedef time_t (*getExternalTime)();
|
||||
// typedef void (*setExternalTime)(const time_t); // not used in this version
|
||||
|
||||
|
||||
/*==============================================================================*/
|
||||
/* Useful Constants */
|
||||
#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 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 */
|
||||
#define minutesToTime_t(M) ((M)*SECS_PER_MIN)
|
||||
#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
|
||||
|
||||
#endif /* _Time_h */
|
||||
|
||||
|
|
|
@ -9,48 +9,29 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "TimeLib.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
const String monthNames[] =
|
||||
{
|
||||
"Error", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
|
||||
};
|
||||
const String monthNames[] = {"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];
|
||||
}
|
||||
|
||||
const String monthShortNames[] = {"Err", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
|
||||
const String monthShortNames[] =
|
||||
{
|
||||
"Err", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
const String monthShortStr(uint8_t month)
|
||||
{
|
||||
const String monthShortStr(uint8_t month) {
|
||||
return monthShortNames[month];
|
||||
}
|
||||
|
||||
const String dayNames[] = {"Err", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
|
||||
|
||||
const String dayNames[] =
|
||||
{
|
||||
"Err", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
|
||||
};
|
||||
|
||||
const String dayStr(uint8_t day)
|
||||
{
|
||||
const String dayStr(uint8_t day) {
|
||||
return dayNames[day];
|
||||
}
|
||||
|
||||
const String dayShortNames[] = {"Err", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
|
||||
const String dayShortNames[] =
|
||||
{
|
||||
"Err", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||
};
|
||||
|
||||
const String dayShortStr(uint8_t day)
|
||||
{
|
||||
const String dayShortStr(uint8_t day) {
|
||||
return dayShortNames[day];
|
||||
}
|
||||
|
|
|
@ -19,10 +19,9 @@ lib_deps =
|
|||
jgromes/RadioLib @ 5.7.0
|
||||
check_tool = cppcheck
|
||||
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
|
||||
test_build_src = yes
|
||||
#monitor_flags = --raw
|
||||
# activate for OTA Update, use the CALLSIGN from is-cfg.json as upload_port:
|
||||
#upload_protocol = espota
|
||||
#upload_port = <CALLSIGN>.local
|
||||
|
@ -35,4 +34,4 @@ build_flags = -Werror -Wall -DUNITY_INCLUDE_PRINT_FORMATTED
|
|||
board = esp32doit-devkit-v1
|
||||
build_flags = -Werror -Wall -DCORE_DEBUG_LEVEL=5 -DUNITY_INCLUDE_PRINT_FORMATTED
|
||||
build_type = debug
|
||||
monitor_filters = esp32_exception_decoder
|
||||
#monitor_filters = esp32_exception_decoder
|
||||
|
|
Ładowanie…
Reference in New Issue