From 882034f30f9152b9c950b84356e6de73c2fae599 Mon Sep 17 00:00:00 2001 From: simonttp78 Date: Sun, 23 Jan 2022 19:09:46 +0100 Subject: [PATCH 1/7] OTA via WebUI --- Firmware/include/config.h | 2 +- Firmware/lib/WebHandler/WebHandler.cpp | 4 +++- Firmware/platformio.ini | 1 + WebUI/src/app/app.component.html | 2 +- WebUI/src/app/app.module.ts | 3 +-- WebUI/src/app/components/navbar/navbar.component.html | 9 ++++++--- .../racedisplay/dog-details/dog-details.component.html | 3 ++- .../components/system-data/system-data.component.html | 4 ++-- .../app/components/system-data/system-data.component.ts | 2 +- 9 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Firmware/include/config.h b/Firmware/include/config.h index db8cfd2d..785125e4 100644 --- a/Firmware/include/config.h +++ b/Firmware/include/config.h @@ -22,7 +22,7 @@ #ifndef GLOBALVAR_H #define GLOBALVAR_H -#define FW_VER "0.9.10" // Flyball ETS firmware version +#define FW_VER "0.9.11" // Flyball ETS firmware version #define Simulate false // Set to true to enable race simulation (see Simulator.h/.cpp) #define NumSimulatedRaces 25 // number of prepeared simulated races. Sererial interface command to change interface: e.g. "race 1" diff --git a/Firmware/lib/WebHandler/WebHandler.cpp b/Firmware/lib/WebHandler/WebHandler.cpp index 8e5f1f74..12e8ea8f 100644 --- a/Firmware/lib/WebHandler/WebHandler.cpp +++ b/Firmware/lib/WebHandler/WebHandler.cpp @@ -2,6 +2,7 @@ // // #include "WebHandler.h" +#include void WebHandlerClass::_WsEvent(AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type, void *arg, uint8_t *data, size_t len) { @@ -195,7 +196,6 @@ void WebHandlerClass::init(int webPort) _lWebSocketReceivedTime = 0; _ws->onEvent(std::bind(&WebHandlerClass::_WsEvent, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6)); - _wsa->onEvent(std::bind(&WebHandlerClass::_WsEvent, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5, std::placeholders::_6)); _server->addHandler(_ws); @@ -218,6 +218,8 @@ void WebHandlerClass::init(int webPort) //Authentication handler _server->on("/auth", HTTP_GET, std::bind(&WebHandlerClass::_onAuth, this, std::placeholders::_1)); + AsyncElegantOTA.begin(_server); // Start ElegantOTA + _server->begin(); _lLastRaceDataBroadcast = 0; diff --git a/Firmware/platformio.ini b/Firmware/platformio.ini index 73294079..961a2783 100644 --- a/Firmware/platformio.ini +++ b/Firmware/platformio.ini @@ -48,6 +48,7 @@ lib_deps = https://github.com/thingSoC/embedis ;Embedis Crypto AsyncTCP + ayushsharma82/AsyncElegantOTA ;ottowinter/ESPAsyncWebServer-esphome @ ^1.2.7 ;makuna/NeoPixelBus @ ^2.6.0 ;mikalhart/TinyGPSPlus @ ^1.0.2 diff --git a/WebUI/src/app/app.component.html b/WebUI/src/app/app.component.html index 4075128c..ff6814d9 100644 --- a/WebUI/src/app/app.component.html +++ b/WebUI/src/app/app.component.html @@ -1,3 +1,3 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/WebUI/src/app/app.module.ts b/WebUI/src/app/app.module.ts index 67236252..fa383972 100644 --- a/WebUI/src/app/app.module.ts +++ b/WebUI/src/app/app.module.ts @@ -10,7 +10,6 @@ import { NavbarComponent } from "./components/navbar/navbar.component"; import { HomeComponent } from "./components/home/home.component"; import { RacedisplayComponent } from "./components/racedisplay/racedisplay.component"; import { ConfigComponent } from "./components/config/config.component"; - import { SystemDataComponent } from "./components/system-data/system-data.component"; import { LightsComponent } from "./components/racedisplay/lights/lights.component"; import { EtsdataService } from "./services/etsdata.service"; @@ -24,7 +23,7 @@ import { TimeDisplayComponent } from "./components/racedisplay/time-display/time import { DogDetailsComponent } from "./components/racedisplay/dog-details/dog-details.component"; const appRoutes: Routes = [ - { path: "", component: HomeComponent }, + { path: "", component: RacedisplayComponent }, { path: "racedisplay", component: RacedisplayComponent }, { path: "config", component: ConfigComponent }, ]; diff --git a/WebUI/src/app/components/navbar/navbar.component.html b/WebUI/src/app/components/navbar/navbar.component.html index 7c247e23..2a85b73a 100644 --- a/WebUI/src/app/components/navbar/navbar.component.html +++ b/WebUI/src/app/components/navbar/navbar.component.html @@ -8,13 +8,16 @@ diff --git a/WebUI/src/app/components/racedisplay/dog-details/dog-details.component.html b/WebUI/src/app/components/racedisplay/dog-details/dog-details.component.html index bc1837cb..6561219b 100644 --- a/WebUI/src/app/components/racedisplay/dog-details/dog-details.component.html +++ b/WebUI/src/app/components/racedisplay/dog-details/dog-details.component.html @@ -28,4 +28,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/WebUI/src/app/components/system-data/system-data.component.html b/WebUI/src/app/components/system-data/system-data.component.html index e2bb8872..47ae6a0d 100644 --- a/WebUI/src/app/components/system-data/system-data.component.html +++ b/WebUI/src/app/components/system-data/system-data.component.html @@ -2,10 +2,10 @@
Batt: {{systemData.batteryPercentage}}% - | T: {{systemData.systemTimestamp | date:'short'}} + | Id: {{systemData.PwrOnTag}}/{{systemData.RaceID}} | Up: {{hmsTime}} + | T: {{systemData.systemTimestamp | date:'short'}} | C: {{systemData.numClients}} - | Id: {{systemData.PwrOnTag}}/{{systemData.RaceID}} | Mem: {{systemData.freeHeap}}
diff --git a/WebUI/src/app/components/system-data/system-data.component.ts b/WebUI/src/app/components/system-data/system-data.component.ts index 919c32f7..0997c722 100644 --- a/WebUI/src/app/components/system-data/system-data.component.ts +++ b/WebUI/src/app/components/system-data/system-data.component.ts @@ -11,7 +11,7 @@ export class SystemDataComponent implements OnInit { hmsTime:string; - systemData:SystemData = {batteryPercentage: 0, systemTimestamp: null, uptime: 0, numClients: 0, PwrOnTag: 0, RaceID: 0, freeHeap: 0}; + systemData:SystemData = {batteryPercentage: 0, PwrOnTag: 0, RaceID: 0, uptime: 0, systemTimestamp: null, numClients: 0, freeHeap: 0}; constructor(private etsDataService:EtsdataService) { this.etsDataService.dataStream.subscribe((data) => { if(data.SystemData) { From a4cbd6c24554b5b0041ef82d09619857109088d6 Mon Sep 17 00:00:00 2001 From: simonttp78 Date: Sun, 23 Jan 2022 19:56:18 +0100 Subject: [PATCH 2/7] partition + WebUI buttons --- Firmware/include/config.h | 2 +- Firmware/partitions_custom.csv | 6 +++--- .../racedisplay/race-control/race-control.component.html | 6 +++--- .../racedisplay/race-control/race-control.component.ts | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Firmware/include/config.h b/Firmware/include/config.h index 785125e4..1bc32d0d 100644 --- a/Firmware/include/config.h +++ b/Firmware/include/config.h @@ -22,7 +22,7 @@ #ifndef GLOBALVAR_H #define GLOBALVAR_H -#define FW_VER "0.9.11" // Flyball ETS firmware version +#define FW_VER "0.9.12" // Flyball ETS firmware version #define Simulate false // Set to true to enable race simulation (see Simulator.h/.cpp) #define NumSimulatedRaces 25 // number of prepeared simulated races. Sererial interface command to change interface: e.g. "race 1" diff --git a/Firmware/partitions_custom.csv b/Firmware/partitions_custom.csv index 2abbf9ba..d568a56a 100644 --- a/Firmware/partitions_custom.csv +++ b/Firmware/partitions_custom.csv @@ -1,6 +1,6 @@ # Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, -app0, app, ota_0, 0x10000, 0x180000, -app1, app, ota_1, 0x190000,0x180000, -spiffs, data, spiffs, 0x310000,0xf0000, +app0, app, ota_0, 0x10000, 0x1e0000, +app1, app, ota_1, 0x1f0000,0x1e0000, +spiffs, data, spiffs, 0x3d0000,0x30000, diff --git a/WebUI/src/app/components/racedisplay/race-control/race-control.component.html b/WebUI/src/app/components/racedisplay/race-control/race-control.component.html index 78b4be46..45cd58eb 100644 --- a/WebUI/src/app/components/racedisplay/race-control/race-control.component.html +++ b/WebUI/src/app/components/racedisplay/race-control/race-control.component.html @@ -1,13 +1,13 @@
- +       - +       - +
diff --git a/WebUI/src/app/components/racedisplay/race-control/race-control.component.ts b/WebUI/src/app/components/racedisplay/race-control/race-control.component.ts index c919bea9..3fb3342d 100644 --- a/WebUI/src/app/components/racedisplay/race-control/race-control.component.ts +++ b/WebUI/src/app/components/racedisplay/race-control/race-control.component.ts @@ -35,8 +35,8 @@ export class RaceControlComponent implements OnChanges, OnInit { this.overallMaxState = Math.max(...this.raceStates.RaceStates); this.startDisabled = !(this.overallMaxState == 0); - this.stopDisabled = (this.overallMaxState == 0 || this.overallMaxState == 3); - this.resetDisabled = !(this.overallMaxState == 3); + this.stopDisabled = !(this.overallMaxState == 1 || this.overallMaxState == 2); + this.resetDisabled = (this.overallMaxState == 1 || this.overallMaxState == 2); } EmitCommand(command: RaceCommandEnum) { From 6584423519b46f79cd817761a85694a7ee0c4576 Mon Sep 17 00:00:00 2001 From: simonttp78 Date: Mon, 24 Jan 2022 23:10:38 +0100 Subject: [PATCH 3/7] readme update --- Firmware/include/config.h | 2 +- Firmware/platformio.ini | 21 +++++++-------------- README.md | 8 ++++---- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Firmware/include/config.h b/Firmware/include/config.h index 1bc32d0d..a7a2e813 100644 --- a/Firmware/include/config.h +++ b/Firmware/include/config.h @@ -22,7 +22,7 @@ #ifndef GLOBALVAR_H #define GLOBALVAR_H -#define FW_VER "0.9.12" // Flyball ETS firmware version +#define FW_VER "0.9.13" // Flyball ETS firmware version #define Simulate false // Set to true to enable race simulation (see Simulator.h/.cpp) #define NumSimulatedRaces 25 // number of prepeared simulated races. Sererial interface command to change interface: e.g. "race 1" diff --git a/Firmware/platformio.ini b/Firmware/platformio.ini index 961a2783..238e4c05 100644 --- a/Firmware/platformio.ini +++ b/Firmware/platformio.ini @@ -33,7 +33,6 @@ upload_protocol = esptool board_build.partitions = partitions_custom.csv - ; if jtag board is in use debug_tool = esp-prog debug_init_break = tbreak setup @@ -41,24 +40,18 @@ debug_init_break = tbreak setup # using the latest stable version lib_deps = ESP Async WebServer - NeoPixelBus - 1655 ;TinyGPSPlus - 887 ;LiquidCrystal by Arduino/Adafruit - bblanchon/ArduinoJson - https://github.com/thingSoC/embedis ;Embedis - Crypto AsyncTCP ayushsharma82/AsyncElegantOTA + makuna/NeoPixelBus @ ^2.6.0 + mikalhart/TinyGPSPlus @ ^1.0.2 + arduino-libraries/LiquidCrystal @ ^1.0.7 + bblanchon/ArduinoJson @ ^6.16.1 + thingSoC/embedis + rweather/Crypto @ ^0.2.0 + Timezone ;ottowinter/ESPAsyncWebServer-esphome @ ^1.2.7 - ;makuna/NeoPixelBus @ ^2.6.0 - ;mikalhart/TinyGPSPlus @ ^1.0.2 - ;arduino-libraries/LiquidCrystal @ ^1.0.7 - ;bblanchon/ArduinoJson @ ^6.16.1 - ;https://github.com/thingSoC/embedis ;Embedis ;links2004/WebSockets @ 2.2.0 - ;rweather/Crypto @ ^0.2.0 ;ottowinter/AsyncTCP-esphome @ ^1.1.1 - Timezone build_flags = -I include/ diff --git a/README.md b/README.md index cf6f1559..f4cb5f7c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ ## FlyballETS-Software by simonttp78 -This project rely on original Flyball ETS project by Alex Gore. Information about initial version, that evolves as well, can be found here: -[Flyball ETS project](https://sparkydevices.wordpress.com/tag/flyball-ets/). -FlyballETS-Software is a for of Alex'es FlyballETS-Software repositorium and contains the sources for the microcontroller software. +This project is a fork of Flyball ETS project by vyruz1986 with several changes. Highlights can be found below. ## Major changes vs FlyballETS original project by Alex Gore @@ -24,8 +22,9 @@ FlyballETS-Software is a for of Alex'es FlyballETS-Software repositorium and con * Battery calibration improvements * Local system time * WebUI and LCD layout changes +* Firmware update via WebUI -> thanks to AsyncElegantOTA by ayushsharma82 * Reset and Manual stop indicated by white fault light blink -* Configurable laser diodes on time in order to simplify set-up process +* Configurable ON time for laser diodes ## Source files @@ -64,3 +63,4 @@ This project was made possible by the following awesome libraries/projects and t - [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) for reliably controlling WS2812 LEDs using ESP32 - [Espurna Project](https://bitbucket.org/xoseperez/espurna) was used as a great example to solve several problems, such as the web UI and the settings interface. - [Timezone](https://github.com/JChristensen/Timezone) used for local time adjustments: time zones and daylight saving time change +- [AsyncElegantOTA](https://github.com/ayushsharma82/AsyncElegantOTA) used for firmware update via WebUI From 17af85185b66660d2677288a498c69bf52740b0c Mon Sep 17 00:00:00 2001 From: simonttp78 Date: Mon, 24 Jan 2022 23:19:06 +0100 Subject: [PATCH 4/7] readme update --- Firmware/platformio.ini | 6 +++--- README.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Firmware/platformio.ini b/Firmware/platformio.ini index 238e4c05..e208aec5 100644 --- a/Firmware/platformio.ini +++ b/Firmware/platformio.ini @@ -39,8 +39,8 @@ debug_init_break = tbreak setup # using the latest stable version lib_deps = - ESP Async WebServer - AsyncTCP + me-no-dev/AsyncTCP + me-no-dev/ESPAsyncWebServer ayushsharma82/AsyncElegantOTA makuna/NeoPixelBus @ ^2.6.0 mikalhart/TinyGPSPlus @ ^1.0.2 @@ -50,8 +50,8 @@ lib_deps = rweather/Crypto @ ^0.2.0 Timezone ;ottowinter/ESPAsyncWebServer-esphome @ ^1.2.7 - ;links2004/WebSockets @ 2.2.0 ;ottowinter/AsyncTCP-esphome @ ^1.1.1 + ;links2004/WebSockets @ 2.2.0 build_flags = -I include/ diff --git a/README.md b/README.md index f4cb5f7c..3209d6f9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ ## FlyballETS-Software by simonttp78 -This project is a fork of Flyball ETS project by vyruz1986 with several changes. Highlights can be found below. +This project is a fork of Flyball ETS project by vyruz1986. Highlights described below. -## Major changes vs FlyballETS original project by Alex Gore +## Major changes vs oryginal FlyballETS project by vyruz1908 * Configurable results accuracy: 2 or 3 digits * Total crossing time replaced with Net time From 6aa0fab05712714475a3cfca96713139fec01291 Mon Sep 17 00:00:00 2001 From: simonttp78 Date: Tue, 25 Jan 2022 08:22:18 +0100 Subject: [PATCH 5/7] embedis lib reference corrected --- Firmware/platformio.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/platformio.ini b/Firmware/platformio.ini index e208aec5..7751f542 100644 --- a/Firmware/platformio.ini +++ b/Firmware/platformio.ini @@ -40,13 +40,13 @@ debug_init_break = tbreak setup # using the latest stable version lib_deps = me-no-dev/AsyncTCP - me-no-dev/ESPAsyncWebServer + me-no-dev/ESP Async WebServer ayushsharma82/AsyncElegantOTA makuna/NeoPixelBus @ ^2.6.0 mikalhart/TinyGPSPlus @ ^1.0.2 arduino-libraries/LiquidCrystal @ ^1.0.7 bblanchon/ArduinoJson @ ^6.16.1 - thingSoC/embedis + https://github.com/thingSoC/embedis rweather/Crypto @ ^0.2.0 Timezone ;ottowinter/ESPAsyncWebServer-esphome @ ^1.2.7 From 1ff73fd94a857fa2123867c19abecad7520170f1 Mon Sep 17 00:00:00 2001 From: simonttp78 Date: Wed, 2 Feb 2022 13:56:03 +0100 Subject: [PATCH 6/7] readme typo update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3209d6f9..4e941f5c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This project is a fork of Flyball ETS project by vyruz1986. Highlights described below. -## Major changes vs oryginal FlyballETS project by vyruz1908 +## Major changes vs oryginal FlyballETS project by vyruz1986 * Configurable results accuracy: 2 or 3 digits * Total crossing time replaced with Net time From b5297c97ee3decc75fa5ae993e6530f48b72e9a8 Mon Sep 17 00:00:00 2001 From: simonttp78 Date: Wed, 2 Feb 2022 14:05:31 +0100 Subject: [PATCH 7/7] OTA partitions size increase --- Firmware/partitions_custom.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Firmware/partitions_custom.csv b/Firmware/partitions_custom.csv index d568a56a..89ddda4c 100644 --- a/Firmware/partitions_custom.csv +++ b/Firmware/partitions_custom.csv @@ -1,6 +1,6 @@ # Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, -app0, app, ota_0, 0x10000, 0x1e0000, -app1, app, ota_1, 0x1f0000,0x1e0000, -spiffs, data, spiffs, 0x3d0000,0x30000, +app0, app, ota_0, 0x10000, 0x1f0000, +app1, app, ota_1, 0x200000,0x1f0000, +spiffs, data, spiffs, 0x3f0000,0x10000,