Module improvements: lvgl, gps, crypt (#585)

This commit is contained in:
Ken Van Hoeylandt
2026-07-25 23:04:39 +02:00
committed by GitHub
parent ca5b071859
commit db7468d0c8
92 changed files with 261 additions and 271 deletions
@@ -1,19 +1,13 @@
#include "tactility/lvgl_module.h"
#include <lvgl/lvgl.h>
#include <lvgl/lvgl_icon_shared.h>
#include <Tactility/Tactility.h>
#include <Tactility/Timer.h>
#include <Tactility/app/AppManifest.h>
#include <Tactility/app/alertdialog/AlertDialog.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/lvgl/Toolbar.h>
#include <tactility/device.h>
#include <tactility/lvgl_icon_shared.h>
#include <atomic>
#include <cstring>
@@ -181,38 +175,35 @@ class GpsSettingsApp final : public App {
}
void updateDeviceStates() {
auto lockable = lvgl::getSyncLock();
auto lock = lockable->asScopedLock();
if (lock.lock(100 / portTICK_PERIOD_MS)) {
for (auto& row : deviceRows) {
const char* text = "Start";
bool enabled = true;
lvgl_lock();
for (const auto& row : deviceRows) {
const char* text = "Start";
bool enabled = true;
if (device_is_ready(row.device)) {
switch (gps_get_state(row.device)) {
case GPS_STATE_PENDING_ON:
text = "Starting...";
enabled = false;
break;
case GPS_STATE_PENDING_OFF:
text = "Stopping...";
enabled = false;
break;
default:
text = "Stop";
enabled = true;
break;
}
}
lv_label_set_text(row.buttonLabel, text);
if (enabled) {
lv_obj_remove_state(row.button, LV_STATE_DISABLED);
} else {
lv_obj_add_state(row.button, LV_STATE_DISABLED);
if (device_is_ready(row.device)) {
switch (gps_get_state(row.device)) {
case GPS_STATE_PENDING_ON:
text = "Starting...";
enabled = false;
break;
case GPS_STATE_PENDING_OFF:
text = "Stopping...";
enabled = false;
break;
default:
text = "Stop";
enabled = true;
break;
}
}
lv_label_set_text(row.buttonLabel, text);
if (enabled) {
lv_obj_remove_state(row.button, LV_STATE_DISABLED);
} else {
lv_obj_add_state(row.button, LV_STATE_DISABLED);
}
}
lvgl_unlock();
}
public: