Update to ESP-IDF v5.4 and fix warnings (#193)
- Update to ESP-IDF v5.4 - Fixed a lot of new and existing warnings - Fix issue with incorrect `EventFlag` usage in Dispatcher
This commit is contained in:
parent
fa54eaa58a
commit
1bb1260ea0
2
.github/actions/build-firmware/action.yml
vendored
2
.github/actions/build-firmware/action.yml
vendored
@ -20,7 +20,7 @@ runs:
|
|||||||
- name: 'Build'
|
- name: 'Build'
|
||||||
uses: espressif/esp-idf-ci-action@main
|
uses: espressif/esp-idf-ci-action@main
|
||||||
with:
|
with:
|
||||||
esp_idf_version: v5.3.2
|
esp_idf_version: v5.4
|
||||||
target: ${{ inputs.arch }}
|
target: ${{ inputs.arch }}
|
||||||
path: './'
|
path: './'
|
||||||
- name: 'Release'
|
- name: 'Release'
|
||||||
|
|||||||
2
.github/actions/build-sdk/action.yml
vendored
2
.github/actions/build-sdk/action.yml
vendored
@ -20,7 +20,7 @@ runs:
|
|||||||
- name: 'Build'
|
- name: 'Build'
|
||||||
uses: espressif/esp-idf-ci-action@main
|
uses: espressif/esp-idf-ci-action@main
|
||||||
with:
|
with:
|
||||||
esp_idf_version: v5.3.2
|
esp_idf_version: v5.4
|
||||||
target: ${{ inputs.arch }}
|
target: ${{ inputs.arch }}
|
||||||
path: './'
|
path: './'
|
||||||
- name: 'Release'
|
- name: 'Release'
|
||||||
|
|||||||
@ -11,4 +11,4 @@ dependencies:
|
|||||||
version: "1.5.0"
|
version: "1.5.0"
|
||||||
rules:
|
rules:
|
||||||
- if: "target == esp32s3"
|
- if: "target == esp32s3"
|
||||||
idf: '5.3.2'
|
idf: '5.4'
|
||||||
|
|||||||
@ -44,6 +44,7 @@ static bool setBacklight(uint8_t duty) {
|
|||||||
.timer_sel = TWODOTFOUR_LCD_BACKLIGHT_LEDC_TIMER,
|
.timer_sel = TWODOTFOUR_LCD_BACKLIGHT_LEDC_TIMER,
|
||||||
.duty = duty,
|
.duty = duty,
|
||||||
.hpoint = 0,
|
.hpoint = 0,
|
||||||
|
.sleep_mode = LEDC_SLEEP_MODE_NO_ALIVE_NO_PD,
|
||||||
.flags = {
|
.flags = {
|
||||||
.output_invert = false
|
.output_invert = false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ static bool init_spi() {
|
|||||||
.data5_io_num = 0,
|
.data5_io_num = 0,
|
||||||
.data6_io_num = 0,
|
.data6_io_num = 0,
|
||||||
.data7_io_num = 0,
|
.data7_io_num = 0,
|
||||||
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = TDECK_SPI_TRANSFER_SIZE_LIMIT,
|
.max_transfer_sz = TDECK_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
|||||||
@ -45,6 +45,7 @@ static bool setBacklight(uint8_t duty) {
|
|||||||
.timer_sel = TDECK_LCD_BACKLIGHT_LEDC_TIMER,
|
.timer_sel = TDECK_LCD_BACKLIGHT_LEDC_TIMER,
|
||||||
.duty = duty,
|
.duty = duty,
|
||||||
.hpoint = 0,
|
.hpoint = 0,
|
||||||
|
.sleep_mode = LEDC_SLEEP_MODE_NO_ALIVE_NO_PD,
|
||||||
.flags = {
|
.flags = {
|
||||||
.output_invert = 0
|
.output_invert = 0
|
||||||
}
|
}
|
||||||
@ -68,6 +69,8 @@ bool TdeckDisplay::start() {
|
|||||||
.user_ctx = nullptr,
|
.user_ctx = nullptr,
|
||||||
.lcd_cmd_bits = 8,
|
.lcd_cmd_bits = 8,
|
||||||
.lcd_param_bits = 8,
|
.lcd_param_bits = 8,
|
||||||
|
.cs_ena_pretrans = 0,
|
||||||
|
.cs_ena_posttrans = 0,
|
||||||
.flags = {
|
.flags = {
|
||||||
.dc_high_on_cmd = 0,
|
.dc_high_on_cmd = 0,
|
||||||
.dc_low_on_data = 0,
|
.dc_low_on_data = 0,
|
||||||
@ -134,6 +137,7 @@ bool TdeckDisplay::start() {
|
|||||||
const lvgl_port_display_cfg_t disp_cfg = {
|
const lvgl_port_display_cfg_t disp_cfg = {
|
||||||
.io_handle = ioHandle,
|
.io_handle = ioHandle,
|
||||||
.panel_handle = panelHandle,
|
.panel_handle = panelHandle,
|
||||||
|
.control_handle = nullptr,
|
||||||
.buffer_size = TDECK_LCD_HORIZONTAL_RESOLUTION * TDECK_LCD_DRAW_BUFFER_HEIGHT * (TDECK_LCD_BITS_PER_PIXEL / 8),
|
.buffer_size = TDECK_LCD_HORIZONTAL_RESOLUTION * TDECK_LCD_DRAW_BUFFER_HEIGHT * (TDECK_LCD_BITS_PER_PIXEL / 8),
|
||||||
.double_buffer = true, // Disable to free up SPIRAM
|
.double_buffer = true, // Disable to free up SPIRAM
|
||||||
.trans_size = 0,
|
.trans_size = 0,
|
||||||
@ -145,12 +149,15 @@ bool TdeckDisplay::start() {
|
|||||||
.mirror_x = true,
|
.mirror_x = true,
|
||||||
.mirror_y = false,
|
.mirror_y = false,
|
||||||
},
|
},
|
||||||
|
.color_format = LV_COLOR_FORMAT_RGB565,
|
||||||
.flags = {
|
.flags = {
|
||||||
.buff_dma = false,
|
.buff_dma = false,
|
||||||
.buff_spiram = true,
|
.buff_spiram = true,
|
||||||
.sw_rotate = false,
|
.sw_rotate = false,
|
||||||
.swap_bytes = false
|
.swap_bytes = false,
|
||||||
},
|
.full_refresh = false,
|
||||||
|
.direct_mode = false
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
displayHandle = lvgl_port_add_disp(&disp_cfg);
|
displayHandle = lvgl_port_add_disp(&disp_cfg);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include <driver/i2c.h>
|
#include <driver/i2c.h>
|
||||||
#include <driver/spi_master.h>
|
#include <driver/spi_master.h>
|
||||||
#include <intr_types.h>
|
#include <esp_intr_types.h>
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "hal/Core2DisplayConstants.h"
|
#include "hal/Core2DisplayConstants.h"
|
||||||
#include "axp192/axp192.h"
|
#include "axp192/axp192.h"
|
||||||
@ -37,7 +37,7 @@ static bool initSpi2() {
|
|||||||
.data7_io_num = GPIO_NUM_NC,
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
.max_transfer_sz = CORE2_LCD_DRAW_BUFFER_SIZE,
|
.max_transfer_sz = CORE2_LCD_DRAW_BUFFER_SIZE,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.isr_cpu_id = INTR_CPU_ID_AUTO,
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
.intr_flags = 0
|
.intr_flags = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include <driver/i2c.h>
|
#include <driver/i2c.h>
|
||||||
#include <driver/spi_master.h>
|
#include <driver/spi_master.h>
|
||||||
#include <intr_types.h>
|
#include <esp_intr_types.h>
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "hal/CoreS3DisplayConstants.h"
|
#include "hal/CoreS3DisplayConstants.h"
|
||||||
#include "kernel/Kernel.h"
|
#include "kernel/Kernel.h"
|
||||||
@ -28,9 +28,10 @@ static bool initSpi3() {
|
|||||||
.data5_io_num = GPIO_NUM_NC,
|
.data5_io_num = GPIO_NUM_NC,
|
||||||
.data6_io_num = GPIO_NUM_NC,
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = CORES3_LCD_DRAW_BUFFER_SIZE,
|
.max_transfer_sz = CORES3_LCD_DRAW_BUFFER_SIZE,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.isr_cpu_id = INTR_CPU_ID_AUTO,
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
.intr_flags = 0
|
.intr_flags = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -29,6 +29,8 @@ bool CoreS3Display::start() {
|
|||||||
.user_ctx = nullptr,
|
.user_ctx = nullptr,
|
||||||
.lcd_cmd_bits = 8,
|
.lcd_cmd_bits = 8,
|
||||||
.lcd_param_bits = 8,
|
.lcd_param_bits = 8,
|
||||||
|
.cs_ena_pretrans = 0,
|
||||||
|
.cs_ena_posttrans = 0,
|
||||||
.flags = {
|
.flags = {
|
||||||
.dc_high_on_cmd = 0,
|
.dc_high_on_cmd = 0,
|
||||||
.dc_low_on_data = 0,
|
.dc_low_on_data = 0,
|
||||||
|
|||||||
@ -27,6 +27,7 @@ static bool initSpi() {
|
|||||||
.data5_io_num = 0,
|
.data5_io_num = 0,
|
||||||
.data6_io_num = 0,
|
.data6_io_num = 0,
|
||||||
.data7_io_num = 0,
|
.data7_io_num = 0,
|
||||||
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = UNPHONE_SPI_TRANSFER_SIZE_LIMIT,
|
.max_transfer_sz = UNPHONE_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
|||||||
@ -87,7 +87,7 @@
|
|||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
static void IRAM_ATTR spi_ready (spi_transaction_t *trans);
|
static void spi_ready(spi_transaction_t*trans);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* STATIC VARIABLES
|
* STATIC VARIABLES
|
||||||
|
|||||||
@ -40,7 +40,7 @@ If you implemented a board yourself, I'm willing to refer to your implementation
|
|||||||
|
|
||||||
### Anything that doesn't fall in the above categories?
|
### Anything that doesn't fall in the above categories?
|
||||||
|
|
||||||
Please [contact me](https://tactility.one/#/support)a me first!
|
Please [contact me](https://tactility.one/#/support) me first!
|
||||||
|
|
||||||
## Pull Requests
|
## Pull Requests
|
||||||
|
|
||||||
|
|||||||
@ -848,20 +848,10 @@ int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y) {
|
bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y) {
|
||||||
if (x < 0 || x >= qrcode->size || y < 0 || y >= qrcode->size) {
|
if (x >= qrcode->size || y >= qrcode->size) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t offset = y * qrcode->size + x;
|
uint32_t offset = y * qrcode->size + x;
|
||||||
return (qrcode->modules[offset >> 3] & (1 << (7 - (offset & 0x07)))) != 0;
|
return (qrcode->modules[offset >> 3] & (1 << (7 - (offset & 0x07)))) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
uint8_t qrcode_getHexLength(QRCode *qrcode) {
|
|
||||||
return ((qrcode->size * qrcode->size) + 7) / 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
void qrcode_getHex(QRCode *qrcode, char *result) {
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|||||||
@ -1,109 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "./App.h"
|
|
||||||
#include "./AppManifest.h"
|
|
||||||
|
|
||||||
namespace tt::app {
|
|
||||||
|
|
||||||
typedef void* (*CreateData)();
|
|
||||||
typedef void (*DestroyData)(void* data);
|
|
||||||
typedef void (*OnStart)(AppContext& app, void* _Nullable data);
|
|
||||||
typedef void (*OnStop)(AppContext& app, void* _Nullable data);
|
|
||||||
typedef void (*OnShow)(AppContext& app, void* _Nullable data, lv_obj_t* parent);
|
|
||||||
typedef void (*OnHide)(AppContext& app, void* _Nullable data);
|
|
||||||
typedef void (*OnResult)(AppContext& app, void* _Nullable data, Result result, std::unique_ptr<Bundle> resultData);
|
|
||||||
|
|
||||||
class AppCompatC : public App {
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
CreateData _Nullable createData;
|
|
||||||
DestroyData _Nullable destroyData;
|
|
||||||
OnStart _Nullable onStartCallback;
|
|
||||||
OnStop _Nullable onStopCallback;
|
|
||||||
OnShow _Nullable onShowCallback;
|
|
||||||
OnHide _Nullable onHideCallback;
|
|
||||||
OnResult _Nullable onResultCallback;
|
|
||||||
|
|
||||||
void* data = nullptr;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
AppCompatC(
|
|
||||||
CreateData _Nullable createData,
|
|
||||||
DestroyData _Nullable destroyData,
|
|
||||||
OnStart _Nullable onStart,
|
|
||||||
OnStop _Nullable onStop,
|
|
||||||
OnShow _Nullable onShow,
|
|
||||||
OnHide _Nullable onHide,
|
|
||||||
OnResult _Nullable onResult
|
|
||||||
) : createData(createData),
|
|
||||||
destroyData(destroyData),
|
|
||||||
onStartCallback(onStart),
|
|
||||||
onStopCallback(onStop),
|
|
||||||
onShowCallback(onShow),
|
|
||||||
onHideCallback(onHide),
|
|
||||||
onResultCallback(onResult)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void onStart(AppContext& appContext) override {
|
|
||||||
if (createData != nullptr) {
|
|
||||||
data = createData();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (onStartCallback != nullptr) {
|
|
||||||
onStartCallback(appContext, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onStop(AppContext& appContext) override {
|
|
||||||
if (onStopCallback != nullptr) {
|
|
||||||
onStopCallback(appContext, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (destroyData != nullptr && data != nullptr) {
|
|
||||||
destroyData(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onShow(AppContext& appContext, lv_obj_t* parent) override {
|
|
||||||
if (onShowCallback != nullptr) {
|
|
||||||
onShowCallback(appContext, data, parent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onHide(AppContext& appContext) override {
|
|
||||||
if (onHideCallback != nullptr) {
|
|
||||||
onHideCallback(appContext, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void onResult(AppContext& appContext, Result result, std::unique_ptr<Bundle> _Nullable resultData) override {
|
|
||||||
if (onResultCallback != nullptr) {
|
|
||||||
onResultCallback(appContext, data, result, std::move(resultData));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
App* createC(
|
|
||||||
CreateData _Nullable createData,
|
|
||||||
DestroyData _Nullable destroyData,
|
|
||||||
OnStart _Nullable onStartCallback,
|
|
||||||
OnStop _Nullable onStopCallback,
|
|
||||||
OnShow _Nullable onShowCallback,
|
|
||||||
OnHide _Nullable onHideCallback,
|
|
||||||
OnResult _Nullable onResultCallback
|
|
||||||
) {
|
|
||||||
return new AppCompatC(
|
|
||||||
createData,
|
|
||||||
destroyData,
|
|
||||||
onStartCallback,
|
|
||||||
onStopCallback,
|
|
||||||
onShowCallback,
|
|
||||||
onHideCallback,
|
|
||||||
onResultCallback
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -9,6 +9,7 @@
|
|||||||
#include "service/loader/Loader.h"
|
#include "service/loader/Loader.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace tt::app {
|
namespace tt::app {
|
||||||
|
|
||||||
@ -19,13 +20,13 @@ struct ElfManifest {
|
|||||||
std::string name;
|
std::string name;
|
||||||
/** Optional icon. */
|
/** Optional icon. */
|
||||||
std::string icon;
|
std::string icon;
|
||||||
CreateData _Nullable createData;
|
CreateData _Nullable createData = nullptr;
|
||||||
DestroyData _Nullable destroyData;
|
DestroyData _Nullable destroyData = nullptr;
|
||||||
OnStart _Nullable onStart;
|
OnStart _Nullable onStart = nullptr;
|
||||||
OnStop _Nullable onStop;
|
OnStop _Nullable onStop = nullptr;
|
||||||
OnShow _Nullable onShow;
|
OnShow _Nullable onShow = nullptr;
|
||||||
OnHide _Nullable onHide;
|
OnHide _Nullable onHide = nullptr;
|
||||||
OnResult _Nullable onResult;
|
OnResult _Nullable onResult = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
static size_t elfManifestSetCount = 0;
|
static size_t elfManifestSetCount = 0;
|
||||||
@ -88,7 +89,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
explicit ElfApp(const std::string& filePath) : filePath(filePath) {}
|
explicit ElfApp(std::string filePath) : filePath(std::move(filePath)) {}
|
||||||
|
|
||||||
void onStart(AppContext& appContext) override {
|
void onStart(AppContext& appContext) override {
|
||||||
auto initial_count = elfManifestSetCount;
|
auto initial_count = elfManifestSetCount;
|
||||||
@ -101,7 +102,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (manifest->onStart != nullptr) {
|
if (manifest->onStart != nullptr) {
|
||||||
manifest->onStart(appContext, data);
|
manifest->onStart(&appContext, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -113,7 +114,7 @@ public:
|
|||||||
TT_LOG_I(TAG, "Cleaning up app");
|
TT_LOG_I(TAG, "Cleaning up app");
|
||||||
if (manifest != nullptr) {
|
if (manifest != nullptr) {
|
||||||
if (manifest->onStop != nullptr) {
|
if (manifest->onStop != nullptr) {
|
||||||
manifest->onStop(appContext, data);
|
manifest->onStop(&appContext, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (manifest->destroyData != nullptr && data != nullptr) {
|
if (manifest->destroyData != nullptr && data != nullptr) {
|
||||||
@ -127,19 +128,19 @@ public:
|
|||||||
|
|
||||||
void onShow(AppContext& appContext, lv_obj_t* parent) override {
|
void onShow(AppContext& appContext, lv_obj_t* parent) override {
|
||||||
if (manifest != nullptr && manifest->onShow != nullptr) {
|
if (manifest != nullptr && manifest->onShow != nullptr) {
|
||||||
manifest->onShow(appContext, data, parent);
|
manifest->onShow(&appContext, data, parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onHide(AppContext& appContext) override {
|
void onHide(AppContext& appContext) override {
|
||||||
if (manifest != nullptr && manifest->onHide != nullptr) {
|
if (manifest != nullptr && manifest->onHide != nullptr) {
|
||||||
manifest->onHide(appContext, data);
|
manifest->onHide(&appContext, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onResult(AppContext& appContext, Result result, std::unique_ptr<Bundle> resultBundle) override {
|
void onResult(AppContext& appContext, Result result, std::unique_ptr<Bundle> resultBundle) override {
|
||||||
if (manifest != nullptr && manifest->onResult != nullptr) {
|
if (manifest != nullptr && manifest->onResult != nullptr) {
|
||||||
manifest->onResult(appContext, data, result, std::move(resultBundle));
|
manifest->onResult(&appContext, data, result, resultBundle.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,12 +1,19 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "AppCompatC.h"
|
|
||||||
#include "AppManifest.h"
|
#include "AppManifest.h"
|
||||||
|
|
||||||
#ifdef ESP_PLATFORM
|
#ifdef ESP_PLATFORM
|
||||||
|
|
||||||
namespace tt::app {
|
namespace tt::app {
|
||||||
|
|
||||||
|
typedef void* (*CreateData)();
|
||||||
|
typedef void (*DestroyData)(void* data);
|
||||||
|
typedef void (*OnStart)(void* appContext, void* _Nullable data);
|
||||||
|
typedef void (*OnStop)(void* appContext, void* _Nullable data);
|
||||||
|
typedef void (*OnShow)(void* appContext, void* _Nullable data, lv_obj_t* parent);
|
||||||
|
typedef void (*OnHide)(void* appContext, void* _Nullable data);
|
||||||
|
typedef void (*OnResult)(void* appContext, void* _Nullable data, Result result, Bundle* resultData);
|
||||||
|
|
||||||
void setElfAppManifest(
|
void setElfAppManifest(
|
||||||
const char* name,
|
const char* name,
|
||||||
const char* _Nullable icon,
|
const char* _Nullable icon,
|
||||||
|
|||||||
@ -13,7 +13,6 @@ namespace tt::app::power {
|
|||||||
#define TAG "power"
|
#define TAG "power"
|
||||||
|
|
||||||
extern const AppManifest manifest;
|
extern const AppManifest manifest;
|
||||||
static void onTimer(TT_UNUSED std::shared_ptr<void> context);
|
|
||||||
|
|
||||||
class PowerApp;
|
class PowerApp;
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
namespace tt::app::textviewer {
|
namespace tt::app::textviewer {
|
||||||
|
|
||||||
void start(const std::string&file);
|
void start(const std::string& file);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -120,11 +120,8 @@ static int32_t guiMain(TT_UNUSED void* p) {
|
|||||||
Gui* local_gui = gui;
|
Gui* local_gui = gui;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
uint32_t flags = Thread::awaitFlags(
|
uint32_t flags = Thread::awaitFlags(GUI_THREAD_FLAG_ALL, EventFlag::WaitAny, portMAX_DELAY);
|
||||||
GUI_THREAD_FLAG_ALL,
|
|
||||||
EventFlag::WaitAny,
|
|
||||||
portMAX_DELAY
|
|
||||||
);
|
|
||||||
// Process and dispatch draw call
|
// Process and dispatch draw call
|
||||||
if (flags & GUI_THREAD_FLAG_DRAW) {
|
if (flags & GUI_THREAD_FLAG_DRAW) {
|
||||||
Thread::clearFlags(GUI_THREAD_FLAG_DRAW);
|
Thread::clearFlags(GUI_THREAD_FLAG_DRAW);
|
||||||
|
|||||||
@ -64,13 +64,10 @@ void stopApp() {
|
|||||||
|
|
||||||
std::shared_ptr<app::AppContext> _Nullable getCurrentAppContext() {
|
std::shared_ptr<app::AppContext> _Nullable getCurrentAppContext() {
|
||||||
assert(loader_singleton);
|
assert(loader_singleton);
|
||||||
if (loader_singleton->mutex.lock(10 / portTICK_PERIOD_MS)) {
|
loader_singleton->mutex.lock();
|
||||||
auto app = loader_singleton->appStack.top();
|
auto app = loader_singleton->appStack.top();
|
||||||
loader_singleton->mutex.unlock();
|
loader_singleton->mutex.unlock();
|
||||||
return std::move(app);
|
return app;
|
||||||
} else {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<app::App> _Nullable getCurrentApp() {
|
std::shared_ptr<app::App> _Nullable getCurrentApp() {
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <Check.h>
|
#include <Check.h>
|
||||||
#include <app/ElfApp.h>
|
#include <app/ElfApp.h>
|
||||||
#include <app/AppCompatC.h>
|
|
||||||
|
|
||||||
#define TAG "tt_app"
|
#define TAG "tt_app"
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ namespace tt {
|
|||||||
|
|
||||||
#define TAG "dispatcher"
|
#define TAG "dispatcher"
|
||||||
#define BACKPRESSURE_WARNING_COUNT ((EventBits_t)100)
|
#define BACKPRESSURE_WARNING_COUNT ((EventBits_t)100)
|
||||||
#define WAIT_FLAG ((EventBits_t)1)
|
#define WAIT_FLAG ((EventBits_t)1U)
|
||||||
|
|
||||||
Dispatcher::~Dispatcher() {
|
Dispatcher::~Dispatcher() {
|
||||||
// Wait for Mutex usage
|
// Wait for Mutex usage
|
||||||
@ -31,38 +31,33 @@ void Dispatcher::dispatch(Function function, std::shared_ptr<void> context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Dispatcher::consume(TickType_t timeout) {
|
uint32_t Dispatcher::consume(TickType_t timeout) {
|
||||||
// Wait for signal and clear
|
// Wait for signal
|
||||||
TickType_t start_ticks = kernel::getTicks();
|
uint32_t result = eventFlag.wait(WAIT_FLAG, EventFlag::WaitAny, timeout);
|
||||||
if (eventFlag.wait(WAIT_FLAG, EventFlag::WaitAny, timeout)) {
|
if (result & EventFlag::Error) {
|
||||||
eventFlag.clear(WAIT_FLAG);
|
|
||||||
} else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TickType_t ticks_remaining = TT_MAX(timeout - (kernel::getTicks() - start_ticks), 0);
|
eventFlag.clear(WAIT_FLAG);
|
||||||
|
|
||||||
TT_LOG_I(TAG, "Dispatcher continuing (%d ticks)", (int)ticks_remaining);
|
|
||||||
|
|
||||||
// Mutate
|
// Mutate
|
||||||
bool processing = true;
|
bool processing = true;
|
||||||
uint32_t consumed = 0;
|
uint32_t consumed = 0;
|
||||||
do {
|
do {
|
||||||
if (mutex.lock(ticks_remaining / portTICK_PERIOD_MS)) {
|
if (mutex.lock(10)) {
|
||||||
if (!queue.empty()) {
|
if (!queue.empty()) {
|
||||||
auto item = queue.front();
|
auto item = queue.front();
|
||||||
queue.pop();
|
queue.pop();
|
||||||
consumed++;
|
consumed++;
|
||||||
processing = !queue.empty();
|
processing = !queue.empty();
|
||||||
// Don't keep lock as callback might be slow
|
// Don't keep lock as callback might be slow
|
||||||
tt_check(mutex.unlock());
|
mutex.unlock();
|
||||||
item->function(item->context);
|
item->function(item->context);
|
||||||
} else {
|
} else {
|
||||||
processing = false;
|
processing = false;
|
||||||
tt_check(mutex.unlock());
|
mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
TT_LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
TT_LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (processing);
|
} while (processing);
|
||||||
|
|||||||
@ -54,7 +54,8 @@ public:
|
|||||||
void dispatch(Function function, std::shared_ptr<void> context);
|
void dispatch(Function function, std::shared_ptr<void> context);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Consume a dispatched function (if any)
|
* Consume 1 or more dispatched function (if any) until the queue is empty.
|
||||||
|
* @warning The timeout is only the wait time before consuming the message! It is not a limit to the total execution time when calling this method.
|
||||||
* @param[in] timeout the ticks to wait for a message
|
* @param[in] timeout the ticks to wait for a message
|
||||||
* @return the amount of messages that were consumed
|
* @return the amount of messages that were consumed
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -738,6 +738,7 @@ static void dispatchConnect(std::shared_ptr<void> context) {
|
|||||||
.threshold = {
|
.threshold = {
|
||||||
.rssi = 0,
|
.rssi = 0,
|
||||||
.authmode = WIFI_AUTH_OPEN,
|
.authmode = WIFI_AUTH_OPEN,
|
||||||
|
.rssi_5g_adjustment = 0
|
||||||
},
|
},
|
||||||
.pmf_cfg = {
|
.pmf_cfg = {
|
||||||
.capable = false,
|
.capable = false,
|
||||||
@ -854,6 +855,7 @@ static void dispatchDisconnectButKeepActive(std::shared_ptr<void> context) {
|
|||||||
.threshold = {
|
.threshold = {
|
||||||
.rssi = 0,
|
.rssi = 0,
|
||||||
.authmode = WIFI_AUTH_OPEN,
|
.authmode = WIFI_AUTH_OPEN,
|
||||||
|
.rssi_5g_adjustment = 0
|
||||||
},
|
},
|
||||||
.pmf_cfg = {
|
.pmf_cfg = {
|
||||||
.capable = false,
|
.capable = false,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user