Skip to content

Commit c2f2660

Browse files
authored
Merge pull request #907 from cyberman54/development
Add CI & fix build errors & migrate RGB LED library
2 parents cfdcdcc + 877557e commit c2f2660

24 files changed

+164
-168
lines changed

.github/workflows/build.yml

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,59 @@ on:
44
pull_request:
55
push:
66
branches:
7-
- master
7+
- master
8+
- build-workflow
9+
workflow_dispatch:
810

911
jobs:
1012
build:
1113
strategy:
1214
fail-fast: false
1315
matrix:
14-
os: [ubuntu-latest, windows-latest, macos-latest]
16+
os: [ubuntu-latest]
17+
# os: [ubuntu-latest, windows-latest, macos-latest]
1518
include:
16-
- os: ubuntu-latest
17-
path: ~/.cache/pip
18-
platformio-path: ~/.platformio
19-
- os: macos-latest
20-
path: ~/Library/Caches/pip
21-
platformio-path: ~/Library/Caches/platformio
22-
- os: windows-latest
23-
path: ~\AppData\Local\pip\Cache
24-
platformio-path: ~\AppData\Local\platformio\Cache
19+
- os: ubuntu-latest
20+
path: ~/.cache/pip
21+
platformio-path: ~/.platformio
22+
# - os: macos-latest
23+
# path: ~/Library/Caches/pip
24+
# platformio-path: ~/Library/Caches/platformio
25+
# - os: windows-latest
26+
# path: ~\AppData\Local\pip\Cache
27+
# platformio-path: ~\AppData\Local\platformio\Cache
28+
board:
29+
[
30+
ebox.h,
31+
eboxtube.h,
32+
ecopower.h,
33+
heltec.h,
34+
heltecv2.h,
35+
heltecv21.h,
36+
ttgov1.h,
37+
ttgov2.h,
38+
ttgov21old.h,
39+
ttgov21new.h,
40+
ttgofox.h,
41+
ttgobeam.h,
42+
ttgobeam10.h,
43+
ttgotdisplay.h,
44+
ttgotwristband.h,
45+
fipy.h,
46+
lopy.h,
47+
lopy4.h,
48+
lolin32litelora.h,
49+
lolin32lora.h,
50+
lolin32lite.h,
51+
wemos32oled.h,
52+
wemos32matrix.h,
53+
octopus32.h,
54+
tinypico.h,
55+
tinypicomatrix.h,
56+
m5core.h,
57+
m5fire.h,
58+
olimexpoeiso.h,
59+
]
2560
runs-on: ${{ matrix.os }}
2661

2762
steps:
@@ -52,5 +87,9 @@ jobs:
5287
cp src/loraconf_sample.h src/loraconf.h
5388
cp src/ota_sample.conf src/ota.conf
5489
cp src/paxcounter_orig.conf src/paxcounter.conf
55-
- name: Run PlatformIO
56-
run: pio run
90+
- name: Clean
91+
run: pio run -t clean -e ci
92+
- name: Run PlatformIO CI for ${{ matrix.board }}
93+
env:
94+
CI_HALFILE: ${{ matrix.board }}
95+
run: pio run -e ci

build.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,16 @@
2727

2828
# check if hal file is present in source directory
2929
halconfig = config.get("board", "halfile")
30+
31+
# check if hal file is set by ENV CI_HALFILE
32+
if os.getenv("CI_HALFILE"):
33+
# if set, use ENV CI_HALFILE
34+
print("CI_HALFILE ENV FOUND")
35+
# override halconfig
36+
halconfig = os.getenv("CI_HALFILE")
37+
3038
halconfigfile = os.path.join (haldir, halconfig)
39+
3140
if os.path.isfile(halconfigfile) and os.access(halconfigfile, os.R_OK):
3241
print("Parsing hardware configuration from " + halconfigfile)
3342
else:
@@ -98,10 +107,10 @@
98107

99108
# get runtime credentials and put them to compiler directive
100109
env.Append(BUILD_FLAGS=[
101-
u'-DWIFI_SSID=\\"' + mykeys["OTA_WIFI_SSID"] + '\\"',
102-
u'-DWIFI_PASS=\\"' + mykeys["OTA_WIFI_PASS"] + '\\"',
103-
u'-DPAXEXPRESS_USER=\\"' + mykeys["PAXEXPRESS_USER"] + '\\"',
104-
u'-DPAXEXPRESS_REPO=\\"' + mykeys["PAXEXPRESS_REPO"] + '\\"',
110+
u'-DWIFI_SSID=\\"' + mykeys["OTA_WIFI_SSID"] + '\\"',
111+
u'-DWIFI_PASS=\\"' + mykeys["OTA_WIFI_PASS"] + '\\"',
112+
u'-DPAXEXPRESS_USER=\\"' + mykeys["PAXEXPRESS_USER"] + '\\"',
113+
u'-DPAXEXPRESS_REPO=\\"' + mykeys["PAXEXPRESS_REPO"] + '\\"',
105114
u'-DPAXEXPRESS_PACKAGE=\\"' + package + '\\"',
106115
u'-DARDUINO_LMIC_PROJECT_CONFIG_H=' + lmicconfig,
107116
u'-I \"' + srcdir + '\"'
@@ -127,7 +136,7 @@ def publish_paxexpress(source, target, env):
127136
}
128137

129138
r = None
130-
139+
131140
try:
132141
r = requests.put(url,
133142
data=open(firmware_path, "rb"),

include/globals.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
#include <Arduino.h>
66

77
// Time functions
8+
#ifdef HAS_RTC
89
#include <RtcDateTime.h>
10+
#endif
911
#include <Ticker.h>
1012

1113
// std::set for unified array functions

include/led.h

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#ifndef _LED_H
22
#define _LED_H
33

4-
#ifdef RGB_LED_COUNT
5-
#include <SmartLeds.h>
4+
#ifdef HAS_RGB_LED
5+
#define FASTLED_INTERNAL
6+
#include <FastLED.h>
7+
#include "libpax_helpers.h"
68
#endif
9+
710
#ifdef HAS_LORA
811
#include "lorawan.h"
912
#endif
@@ -12,39 +15,26 @@
1215
#define RGB_LED_COUNT 1
1316
#endif
1417

15-
// value for HSL color
16-
// see http://www.workwithcolor.com/blue-color-hue-range-01.htm
17-
#define COLOR_RED 0
18-
#define COLOR_ORANGE 30
19-
#define COLOR_ORANGE_YELLOW 45
20-
#define COLOR_YELLOW 60
21-
#define COLOR_YELLOW_GREEN 90
22-
#define COLOR_GREEN 120
23-
#define COLOR_GREEN_CYAN 165
24-
#define COLOR_CYAN 180
25-
#define COLOR_CYAN_BLUE 210
26-
#define COLOR_BLUE 240
27-
#define COLOR_BLUE_MAGENTA 275
28-
#define COLOR_MAGENTA 300
29-
#define COLOR_PINK 350
30-
#define COLOR_WHITE 360
31-
#define COLOR_NONE 999
32-
33-
struct RGBColor {
34-
uint8_t R;
35-
uint8_t G;
36-
uint8_t B;
37-
};
38-
3918
enum led_states { LED_OFF, LED_ON };
4019

20+
enum colors {
21+
COLOR_WHITE = 0xFFFFFF,
22+
COLOR_NONE = 0x000000,
23+
COLOR_CYAN = 0x00FFFF,
24+
COLOR_BLUE = 0x0000FF,
25+
COLOR_GREEN = 0x008000,
26+
COLOR_YELLOW = 0xFFFF00,
27+
COLOR_ORANGE = 0xFFA500,
28+
COLOR_RED = 0xFF0000,
29+
COLOR_PINK = 0xFFC0CB
30+
};
31+
4132
extern TaskHandle_t ledLoopTask;
4233

43-
// Exported Functions
44-
void rgb_set_color(uint16_t hue);
45-
void blink_LED(uint16_t set_color, uint16_t set_blinkduration);
34+
void rgb_led_init(void);
35+
void rgb_set_color(uint32_t color);
4636
void ledLoop(void *parameter);
47-
void switch_LED(uint8_t state);
48-
void switch_LED1(uint8_t state);
37+
void switch_LED(led_states state);
38+
void switch_LED1(led_states state);
4939

5040
#endif

include/ledmatrixdisplay.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "LEDMatrix.h"
77
#include "ledmatrixfonts.h"
88
#include "ledmatrixdisplay.h"
9+
#include "configmanager.h"
10+
#include <libpax_api.h>
911

1012
extern uint8_t MatrixDisplayIsOn;
1113
extern LEDMatrix matrix;

include/sdcard.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
#elif HAS_SDCARD == 2 // MMC interface
3434
#include "driver/sdmmc_host.h"
3535

36+
#ifndef SDCARD_SLOTCONFIG
37+
#define SDCARD_SLOTCONFIG SDMMC_SLOT_CONFIG_DEFAULT()
38+
#endif
39+
3640
#ifndef SDCARD_SLOTWIDTH
3741
#define SDCARD_SLOTWIDTH 1
3842
#endif

platformio_orig.ini

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ lib_deps_display =
6767
lib_deps_ledmatrix =
6868
seeed-studio/Ultrathin_LED_Matrix @ ^1.0.0
6969
lib_deps_rgbled =
70-
https://github.com/RoboticsBrno/SmartLeds.git
70+
fastled/FastLED @ ^3.5.0
7171
lib_deps_gps =
7272
mikalhart/TinyGPSPlus @ ^1.0.3
7373
lib_deps_sensors =
@@ -82,7 +82,7 @@ lib_deps_basic =
8282
https://github.com/SukkoPera/Arduino-Rokkit-Hash.git
8383
bblanchon/ArduinoJson @ ^6
8484
makuna/RTC @ ^2.3.5
85-
spacehuhn/SimpleButton
85+
spacehuhn/SimpleButton
8686
lewisxhe/XPowersLib @ ^0.1.4
8787
256dpi/MQTT @ ^2.5.0
8888
lib_deps_all =
@@ -94,7 +94,6 @@ lib_deps_all =
9494
${common.lib_deps_sensors}
9595
${common.lib_deps_ledmatrix}
9696
build_flags_basic =
97-
-include "src/hal/${board.halfile}"
9897
-include "src/paxcounter.conf"
9998
'-DCORE_DEBUG_LEVEL=${common.debug_level}'
10099
'-DLOG_LOCAL_LEVEL=${common.debug_level}'
@@ -115,7 +114,9 @@ upload_speed = ${common.upload_speed}
115114
;upload_port = COM12
116115
platform = ${common.platform_espressif32}
117116
lib_deps = ${common.lib_deps_all}
118-
build_flags = ${common.build_flags_all}
117+
build_flags =
118+
-include "src/hal/${board.halfile}"
119+
${common.build_flags_all}
119120
upload_protocol = ${common.upload_protocol}
120121
extra_scripts = ${common.extra_scripts}
121122
monitor_speed = ${common.monitor_speed}
@@ -131,3 +132,9 @@ upload_protocol = esptool
131132
upload_protocol = esptool
132133
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
133134
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
135+
136+
[env:ci]
137+
build_flags =
138+
-include "src/hal/${sysenv.CI_HALFILE}" ; set by CI
139+
${common.build_flags_all}
140+
upload_protocol = esptool

src/hal/eboxtube.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#define HAS_LED (22) // Green LED on board
1717
#define RGB_LED_COUNT 1 // we have 1 LED
18-
#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, RGB_LED_COUNT, GPIO_NUM_2) // WS2812B RGB LED on board
18+
#define HAS_RGB_LED FastLED.addLeds<WS2812, GPIO_NUM_2, GRB>(leds, RGB_LED_COUNT);
1919
#define HAS_BUTTON (0) // button "FLASH" on board
2020
#define DISABLE_BROWNOUT 1 // comment out if you want to keep brownout feature
2121

src/hal/fipy.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
#define CFG_sx1272_radio 1
1515
#define HAS_LED NOT_A_PIN // FiPy has no on board LED, so we use RGB LED
16-
#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, 1, GPIO_NUM_0) // WS2812B RGB LED on GPIO0
16+
#define RGB_LED_COUNT 1 // we have 1 LED
17+
#define HAS_RGB_LED FastLED.addLeds<WS2812, GPIO_NUM_0, GRB>(leds, RGB_LED_COUNT);
1718
#define BOARD_HAS_PSRAM // use extra 4MB extern RAM
1819

1920
// Pins for LORA chip SPI interface, reset line and interrupt lines

src/hal/generic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272

7373
#define HAS_LED (21) // on board LED
7474
#define HAS_BUTTON (39) // on board button
75-
#define HAS_RGB_LED SmartLed rgb_led(LED_WS2812, 1, GPIO_NUM_0) // WS2812B RGB LED on GPIO0
75+
#define RGB_LED_COUNT 1 // we have 1 LED
76+
#define HAS_RGB_LED FastLED.addLeds<WS2812, GPIO_NUM_0, GRB>(leds, RGB_LED_COUNT);
7677

7778
// GPS settings
7879
#define HAS_GPS 1 // use on board GPS

0 commit comments

Comments
 (0)