Changed partition table to allow for OTA updates
This commit is contained in:
parent
1d2c90fd60
commit
38efc73ca4
14 changed files with 92 additions and 13 deletions
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
|
@ -44,7 +44,7 @@ jobs:
|
|||
run: pip install --upgrade esptool
|
||||
|
||||
- name: Create merged firmware binary
|
||||
run: mkdir -p output && esptool.py --chip esp32s3 merge_bin -o output/full-firmware.bin --flash_mode dio 0x0000 .pio/build/lolin_s3_mini_qr/bootloader.bin 0x8000 .pio/build/lolin_s3_mini_qr/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/lolin_s3_mini_qr/firmware.bin 0x330000 .pio/build/lolin_s3_mini_qr/littlefs.bin
|
||||
run: mkdir -p output && esptool.py --chip esp32s3 merge_bin -o output/full-firmware.bin --flash_mode dio 0x0000 .pio/build/lolin_s3_mini_qr/bootloader.bin 0x8000 .pio/build/lolin_s3_mini_qr/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/lolin_s3_mini_qr/firmware.bin 0x369000 .pio/build/lolin_s3_mini_qr/littlefs.bin
|
||||
|
||||
- name: Create checksum for merged binary
|
||||
run: shasum -a 256 output/full-firmware.bin | awk '{print $1}' > output/full-firmware.sha256
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
dependencies:
|
||||
esp_littlefs:
|
||||
component_hash: afa6d4544fadca368a35eb712d427cbb8334bc4f35a8f8299261b959a443c832
|
||||
component_hash: null
|
||||
source:
|
||||
git: https://github.com/joltwallet/esp_littlefs.git
|
||||
path: .
|
||||
type: git
|
||||
version: b671069b1e9e279f357736e7b51402f46e39d1b5
|
||||
path: /Users/padjuri/src/btclock_espidf/btclock_espidf/managed_components/esp_littlefs
|
||||
type: local
|
||||
version: 1.10.2
|
||||
idf:
|
||||
component_hash: null
|
||||
source:
|
||||
type: idf
|
||||
version: 4.4.5
|
||||
manifest_hash: 4b13ff241ec4d36ca2303b885c7088c32d74d090ef8e0ca6ea4c7d53047011d6
|
||||
manifest_hash: 4796491ac0ef21bc9e7da581f1db6c59f92d6096be0ffd2d5fa4f2645943c54a
|
||||
target: esp32s3
|
||||
version: 1.0.0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, 36K, 20K,
|
||||
otadata, data, ota, 56K, 8K,
|
||||
app0, app, ota_0, 64K, 3200K,
|
||||
#app1, app, ota_1, , 1600K,
|
||||
spiffs, data, spiffs, , 600K,
|
||||
app0, app, ota_0, 64K, 1700K,
|
||||
app1, app, ota_1, , 1700K,
|
||||
spiffs, data, spiffs, , 400K,
|
||||
coredump, data, coredump,, 64K,
|
||||
|
|
|
|
@ -118,4 +118,9 @@ bool isBlockNotifyConnected() {
|
|||
if (blockNotifyClient == NULL)
|
||||
return false;
|
||||
return esp_websocket_client_is_connected(blockNotifyClient);
|
||||
}
|
||||
|
||||
void stopBlockNotify() {
|
||||
esp_websocket_client_stop(blockNotifyClient);
|
||||
esp_websocket_client_destroy(blockNotifyClient);
|
||||
}
|
|
@ -20,3 +20,4 @@ void onWebsocketMessage(esp_websocket_event_data_t* event_data);
|
|||
|
||||
unsigned long getBlockHeight();
|
||||
bool isBlockNotifyConnected();
|
||||
void stopBlockNotify();
|
|
@ -37,8 +37,7 @@ void setup()
|
|||
xTaskCreate(setupWebsocketClients, "setupWebsocketClients", 4096, NULL, tskIDLE_PRIORITY, NULL);
|
||||
|
||||
setupButtonTask();
|
||||
Serial.printf("Number of free Preferences entries %d", preferences.freeEntries());
|
||||
|
||||
setupOTA();
|
||||
}
|
||||
|
||||
void tryImprovSetup()
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <map>
|
||||
|
||||
#include "ota.hpp"
|
||||
#include "lib/screen_handler.hpp"
|
||||
#include "lib/webserver.hpp"
|
||||
#include "lib/block_notify.hpp"
|
||||
|
|
51
src/lib/ota.cpp
Normal file
51
src/lib/ota.cpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include "ota.hpp"
|
||||
|
||||
TaskHandle_t taskOtaHandle = NULL;
|
||||
|
||||
|
||||
void setupOTA()
|
||||
{
|
||||
ArduinoOTA.onStart(onOTAStart);
|
||||
|
||||
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total)
|
||||
{ Serial.printf("OTA Progress: %u%%\r", (progress / (total / 100))); });
|
||||
|
||||
ArduinoOTA.onEnd([]()
|
||||
{ Serial.println("\nOTA update finished"); });
|
||||
|
||||
|
||||
ArduinoOTA.setHostname(getMyHostname().c_str());
|
||||
ArduinoOTA.setMdnsEnabled(false);
|
||||
ArduinoOTA.begin();
|
||||
|
||||
xTaskCreate(handleOTATask, "handleOTA", 4096, NULL, tskIDLE_PRIORITY, &taskOtaHandle);
|
||||
|
||||
}
|
||||
|
||||
void onOTAStart()
|
||||
{
|
||||
// Stop all timers
|
||||
esp_timer_stop(screenRotateTimer);
|
||||
esp_timer_stop(minuteTimer);
|
||||
|
||||
// Stop or suspend all tasks
|
||||
vTaskSuspend(priceUpdateTaskHandle);
|
||||
vTaskSuspend(blockUpdateTaskHandle);
|
||||
vTaskSuspend(timeUpdateTaskHandle);
|
||||
vTaskSuspend(taskScreenRotateTaskHandle);
|
||||
|
||||
vTaskSuspend(ledTaskHandle);
|
||||
vTaskSuspend(buttonTaskHandle);
|
||||
|
||||
stopWebServer();
|
||||
stopBlockNotify();
|
||||
stopPriceNotify();
|
||||
}
|
||||
|
||||
void handleOTATask(void *parameter) {
|
||||
for (;;) {
|
||||
// Task 1 code
|
||||
ArduinoOTA.handle(); // Allow OTA updates to occur
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
}
|
||||
}
|
8
src/lib/ota.hpp
Normal file
8
src/lib/ota.hpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <Arduino.h>
|
||||
#include <ArduinoOTA.h>
|
||||
#include "config.hpp"
|
||||
#include "shared.hpp"
|
||||
|
||||
void setupOTA();
|
||||
void onOTAStart();
|
||||
void handleOTATask(void *parameter);
|
|
@ -73,4 +73,9 @@ bool isPriceNotifyConnected() {
|
|||
if (clientPrice == NULL)
|
||||
return false;
|
||||
return esp_websocket_client_is_connected(clientPrice);
|
||||
}
|
||||
|
||||
void stopPriceNotify() {
|
||||
esp_websocket_client_stop(clientPrice);
|
||||
esp_websocket_client_destroy(clientPrice);
|
||||
}
|
|
@ -15,4 +15,5 @@ void onWebsocketPriceEvent(void *handler_args, esp_event_base_t base, int32_t ev
|
|||
void onWebsocketPriceMessage(esp_websocket_event_data_t* event_data);
|
||||
|
||||
unsigned long getPrice();
|
||||
bool isPriceNotifyConnected();
|
||||
bool isPriceNotifyConnected();
|
||||
void stopPriceNotify();
|
|
@ -13,6 +13,10 @@ extern TaskHandle_t blockUpdateTaskHandle;
|
|||
extern TaskHandle_t timeUpdateTaskHandle;
|
||||
extern TaskHandle_t taskScreenRotateTaskHandle;
|
||||
|
||||
extern esp_timer_handle_t screenRotateTimer;
|
||||
extern esp_timer_handle_t minuteTimer;
|
||||
|
||||
|
||||
uint getCurrentScreen();
|
||||
void setCurrentScreen(uint newScreen);
|
||||
void nextScreen();
|
||||
|
|
|
@ -70,6 +70,10 @@ void setupWebserver()
|
|||
xTaskCreate(eventSourceTask, "eventSourceTask", 4096, NULL, tskIDLE_PRIORITY, &eventSourceTaskHandle);
|
||||
}
|
||||
|
||||
void stopWebServer() {
|
||||
server.end();
|
||||
}
|
||||
|
||||
StaticJsonDocument<768> getStatusObject()
|
||||
{
|
||||
StaticJsonDocument<768> root;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
extern TaskHandle_t eventSourceTaskHandle;
|
||||
|
||||
void stopWebServer();
|
||||
void setupWebserver();
|
||||
bool processEpdColorSettings(AsyncWebServerRequest *request);
|
||||
|
||||
|
|
Loading…
Reference in a new issue