Skip to content

Commit

Permalink
Merge pull request #38 from simonttp78/develop
Browse files Browse the repository at this point in the history
OTA via WebUI
simonttp78 authored Feb 2, 2022
2 parents c045f2c + b5297c9 commit 2642c44
Showing 13 changed files with 41 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Firmware/include/config.h
Original file line number Diff line number Diff line change
@@ -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.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"
4 changes: 3 additions & 1 deletion Firmware/lib/WebHandler/WebHandler.cpp
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
//
//
#include "WebHandler.h"
#include <AsyncElegantOTA.h>

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;
6 changes: 3 additions & 3 deletions Firmware/partitions_custom.csv
Original file line number Diff line number Diff line change
@@ -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, 0x1f0000,
app1, app, ota_1, 0x200000,0x1f0000,
spiffs, data, spiffs, 0x3f0000,0x10000,
28 changes: 11 additions & 17 deletions Firmware/platformio.ini
Original file line number Diff line number Diff line change
@@ -33,31 +33,25 @@ upload_protocol = esptool

board_build.partitions = partitions_custom.csv


; if jtag board is in use
debug_tool = esp-prog
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
me-no-dev/AsyncTCP
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
https://github.com/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
;links2004/WebSockets @ 2.2.0

build_flags =
-I include/
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
## 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. Highlights described below.

## Major changes vs FlyballETS original project by Alex Gore
## Major changes vs oryginal FlyballETS project by vyruz1986

* Configurable results accuracy: 2 or 3 digits
* Total crossing time replaced with Net time
@@ -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

@@ -66,3 +65,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
2 changes: 1 addition & 1 deletion WebUI/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<app-navbar></app-navbar>
<router-outlet></router-outlet>
<app-system-data></app-system-data>
<!-- <app-system-data></app-system-data>-->
3 changes: 1 addition & 2 deletions WebUI/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -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 },
];
9 changes: 6 additions & 3 deletions WebUI/src/app/components/navbar/navbar.component.html
Original file line number Diff line number Diff line change
@@ -8,13 +8,16 @@
<div class="navbar-collapse" [ngbCollapse]="navbarCollapsed" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item" [routerLinkActive]="['active']" [routerLinkActiveOptions]= "{exact: true}">
<a class="nav-link" [routerLink]="['']" (click)="navbarCollapsed = true">Home</a>
<a class="nav-link" [routerLink]="['']" (click)="navbarCollapsed = true">Race</a>
</li>
<li class="nav-item" [routerLinkActive]="['active']" [routerLinkActiveOptions]= "{exact: true}">
<!-- <li class="nav-item" [routerLinkActive]="['active']" [routerLinkActiveOptions]= "{exact: true}">
<a class="nav-link" [routerLink]="['racedisplay']" (click)="navbarCollapsed = true">Race Display</a>
</li>
</li> -->
<li class="nav-item" [routerLinkActive]="['active']" [routerLinkActiveOptions]= "{exact: true}">
<a class="nav-link" [routerLink]="['config']" (click)="navbarCollapsed = true">Configuration</a>
</li>
<li class="nav-item" [routerLinkActive]="['active']" [routerLinkActiveOptions]= "{exact: true}">
<a class="nav-link" href="/update">Firmware update</a>
</li>
</ul>
</div>
Original file line number Diff line number Diff line change
@@ -28,4 +28,5 @@
</ng-container>
</div>
</li>
</ul>
</ul>
<app-system-data></app-system-data>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div>
<button type="button" class="btn btn-success" (click)="EmitCommand(0)" >Start</button>
<button type="button" class="btn btn-success" (click)="EmitCommand(0)" [disabled]="startDisabled" >Start</button>
&nbsp;
&nbsp;
&nbsp;
<button type="button" class="btn btn-danger" (click)="EmitCommand(1)" >Stop</button>
<button type="button" class="btn btn-danger" (click)="EmitCommand(1)" [disabled]="stopDisabled" >Stop</button>
&nbsp;
&nbsp;
&nbsp;
<button type="button" class="btn btn-info" (click)="EmitCommand(2)" >Reset</button>
<button type="button" class="btn btn-info" (click)="EmitCommand(2)" [disabled]="resetDisabled" >Reset</button>
</div>
<div class="raceState">
<span [ngClass]="{'badge': true, 'badge-success': overallMaxState == 0, 'badge-warning': overallMaxState == 1, 'badge-danger': overallMaxState == 2}">
Original file line number Diff line number Diff line change
@@ -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) {
Original file line number Diff line number Diff line change
@@ -2,10 +2,10 @@
<div class="container">
<span class="badge badge-info text-center">
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}}
</span>
</div>
Original file line number Diff line number Diff line change
@@ -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) {

0 comments on commit 2642c44

Please sign in to comment.