Whoops, that was a brain eraser

This commit is contained in:
DTTerastar 2021-03-27 10:58:54 -04:00
parent 87c98e12ab
commit 9f1ee25a7b
4 changed files with 24 additions and 27 deletions

View File

@ -29,13 +29,13 @@ jobs:
run: echo "PLATFORMIO_BUILD_FLAGS=-DVERSION='\"${GITHUB_REF#refs/*/}\"'" >> $GITHUB_ENV run: echo "PLATFORMIO_BUILD_FLAGS=-DVERSION='\"${GITHUB_REF#refs/*/}\"'" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
- name: Run PlatformIO - name: Run PlatformIO
run: pio run -e esp32 -e m5stickc -e m5stickc-plus -e m5stack-atom run: pio run -e esp32 -e m5stickc -e m5stickc-plus -e m5atom-matrix
- name: Rename firmware - name: Rename firmware
run: | run: |
cp .pio/build/esp32/firmware.bin esp32.bin cp .pio/build/esp32/firmware.bin esp32.bin
cp .pio/build/m5stickc/firmware.bin m5stickc.bin cp .pio/build/m5stickc/firmware.bin m5stickc.bin
cp .pio/build/m5stickc-plus/firmware.bin m5stickc-plus.bin cp .pio/build/m5stickc-plus/firmware.bin m5stickc-plus.bin
cp .pio/build/m5stack-atom/firmware.bin m5stack-atom.bin cp .pio/build/m5atom-matrix/firmware.bin m5atom-matrix.bin
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')

View File

@ -69,7 +69,7 @@ build_flags =
-D PLUS -D PLUS
-D FIRMWARE='"m5stickc-plus"' -D FIRMWARE='"m5stickc-plus"'
[env:m5stack-atom] [env:m5atom-matrix]
platform = espressif32 platform = espressif32
platform_packages = framework-arduinoespressif32 @ https://github.com/DTTerastar/arduino-esp32.git#follow-redirects-http-update platform_packages = framework-arduinoespressif32 @ https://github.com/DTTerastar/arduino-esp32.git#follow-redirects-http-update
framework = arduino framework = arduino
@ -87,7 +87,7 @@ monitor_speed = 115200
build_flags = build_flags =
-D M5ATOM -D M5ATOM
-D MATRIX -D MATRIX
-D FIRMWARE='"m5stack-atom"' -D FIRMWARE='"m5atom-matrix"'
[env:verbose] [env:verbose]
platform = espressif32 platform = espressif32

View File

@ -29,7 +29,6 @@
//Replace with the room name where the node will be placed //Replace with the room name where the node will be placed
#define DEFAULT_ROOM "living-room" #define DEFAULT_ROOM "living-room"
//Specify the LED pin. For most dev boards, this is GPIO2
#ifdef M5STICK #ifdef M5STICK
#define LED_BUILTIN 10 #define LED_BUILTIN 10
@ -38,14 +37,21 @@
#define BUTTON 39 #define BUTTON 39
#define BUTTON_PRESSED 0 #define BUTTON_PRESSED 0
#else
#if M5ATOM
#define LED_BUILTIN 10
#define LED_BUILTIN_ON 0
#define BUTTON 39
#define BUTTON_PRESSED 0
#else // Huzzah32 #else // Huzzah32
#define LED_BUILTIN 13 #define LED_BUILTIN 13
#define LED_BUILTIN_ON 1 #define LED_BUILTIN_ON 1
#define BUTTON 39 #endif
#define BUTTON_PRESSED 1
#endif #endif
#ifdef M5STICK #ifdef M5STICK

View File

@ -475,21 +475,9 @@ void firmwareUpdate(void)
WiFiClientSecure client; WiFiClientSecure client;
client.setInsecure(); client.setInsecure();
httpUpdate.setLedPin(LED_BUILTIN, LOW); httpUpdate.setLedPin(LED_BUILTIN, LED_BUILTIN_ON);
httpUpdate.setFollowRedirects(HTTPC_FORCE_FOLLOW_REDIRECTS); httpUpdate.setFollowRedirects(HTTPC_FORCE_FOLLOW_REDIRECTS);
#ifdef M5STICK String firmwareUrl = Sprintf("https://github.com/DTTerastar/ESP32-mqtt-room/releases/latest/download/%s.bin", FIRMWARE);
#ifdef PLUS
String firmwareUrl = String("https://github.com/DTTerastar/ESP32-mqtt-room/releases/latest/download/m5stickc-plus.bin");
#else
String firmwareUrl = String("https://github.com/DTTerastar/ESP32-mqtt-room/releases/latest/download/m5stickc.bin");
#endif
#else
#ifdef M5ATOM
String firmwareUrl = String("https://github.com/DTTerastar/ESP32-mqtt-room/releases/latest/download/m5stack-atom.bin");
#else
String firmwareUrl = String("https://github.com/DTTerastar/ESP32-mqtt-room/releases/latest/download/esp32.bin");
#endif
#endif
HTTPClient http; HTTPClient http;
if (!http.begin(client, firmwareUrl)) if (!http.begin(client, firmwareUrl))
@ -530,12 +518,14 @@ void firmwareUpdate(void)
void spiffsInit() void spiffsInit()
{ {
int ledState = HIGH; int ledState = HIGH;
int flashes = 0;
unsigned long debounceDelay = 250;
digitalWrite(LED_BUILTIN, ledState); digitalWrite(LED_BUILTIN, ledState);
#ifdef BUTTON
pinMode(BUTTON, INPUT);
int flashes = 0;
unsigned long debounceDelay = 250;
long lastDebounceTime = millis(); long lastDebounceTime = millis();
while (digitalRead(BUTTON) == BUTTON_PRESSED) while (digitalRead(BUTTON) == BUTTON_PRESSED)
{ {
@ -559,12 +549,13 @@ void spiffsInit()
} }
} }
#endif
SPIFFS.begin(true); SPIFFS.begin(true);
} }
void setup() void setup()
{ {
pinMode(BUTTON, INPUT);
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200); Serial.begin(115200);