Remove old HAL components and refactored GPS-related code (#583)
- Added generic GPS/GNSS support with device detection, configuration, and persistent settings. - Improved device and module lifecycle management. - Added flexible filesystem locking support for displays and storage. - Improved display-idle and keyboard backlight handling. - Updated architecture, driver, module, testing, and licensing documentation. - Removed old HAL device and related code.
This commit is contained in:
committed by
GitHub
parent
29e80cfd65
commit
2a2558b29a
@@ -1,5 +1,6 @@
|
||||
dependencies:
|
||||
- Platforms/platform-esp32
|
||||
- Drivers/gps-generic-module
|
||||
- Drivers/st7789-module
|
||||
- Drivers/gt911-module
|
||||
- Drivers/lilygo-module
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <bindings/es7210.h>
|
||||
#include <bindings/dummy_i2s_amp.h>
|
||||
|
||||
#include <gps_generic/bindings.h>
|
||||
|
||||
#include <lilygo/bindings/tdeck_keyboard.h>
|
||||
#include <lilygo/bindings/tdeck_keyboard_backlight.h>
|
||||
#include <lilygo/bindings/tdeck_trackball.h>
|
||||
@@ -188,5 +190,12 @@
|
||||
port = <UART_NUM_1>;
|
||||
pin-tx = <&gpio0 43 GPIO_FLAG_NONE>;
|
||||
pin-rx = <&gpio0 44 GPIO_FLAG_NONE>;
|
||||
|
||||
gps {
|
||||
compatible = "tactility,gps-generic";
|
||||
status = "disabled";
|
||||
baud-rate = <38400>;
|
||||
model = <GPS_MODEL_UBLOX10>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,75 +1,57 @@
|
||||
#include <tactility/module.h>
|
||||
#include <tactility/delay.h>
|
||||
#include <tactility/error.h>
|
||||
#include <tactility/log.h>
|
||||
#include <tactility/lvgl_module.h>
|
||||
#include <tactility/module.h>
|
||||
|
||||
#include <Tactility/SystemEvents.h>
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/hal/gps/GpsConfiguration.h>
|
||||
#include <Tactility/kernel/Kernel.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/service/gps/GpsService.h>
|
||||
#include <Tactility/settings/TrackballSettings.h>
|
||||
|
||||
#include <lilygo/drivers/trackball.h>
|
||||
#include <lilygo/drivers/tdeck_power_on.h>
|
||||
|
||||
#include <driver/gpio.h>
|
||||
|
||||
constexpr auto* TAG = "tdeck-plus";
|
||||
|
||||
extern "C" {
|
||||
|
||||
void subscribe_events() {
|
||||
tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](tt::kernel::SystemEvent event) {
|
||||
auto gps_service = tt::service::gps::findGpsService();
|
||||
if (gps_service != nullptr) {
|
||||
std::vector<tt::hal::gps::GpsConfiguration> gps_configurations;
|
||||
gps_service->getGpsConfigurations(gps_configurations);
|
||||
if (gps_configurations.empty()) {
|
||||
if (gps_service->addGpsConfiguration(tt::hal::gps::GpsConfiguration {.uartName = "uart0", .baudRate = 38400, .model = tt::hal::gps::GpsModel::UBLOX10})) {
|
||||
LOG_I(TAG, "Configured internal GPS");
|
||||
} else {
|
||||
LOG_E(TAG, "Failed to configure internal GPS");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
static tt::kernel::SystemEventSubscription tdeck_boot_splash_subscription = tt::kernel::NoSystemEventSubscription;
|
||||
|
||||
// The kernel trackball device is already started by kernel_init(); this just registers it as an
|
||||
// LVGL input device and applies persisted settings, both of which require LVGL to be up first.
|
||||
tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](tt::kernel::SystemEvent event) {
|
||||
auto tbSettings = tt::settings::trackball::loadOrGetDefault();
|
||||
lvgl_lock();
|
||||
if (trackball::init() != nullptr) {
|
||||
trackball::setMode(tbSettings.trackballMode == tt::settings::trackball::TrackballMode::Pointer
|
||||
? trackball::Mode::Pointer
|
||||
: trackball::Mode::Encoder);
|
||||
trackball::setEncoderSensitivity(tbSettings.encoderSensitivity);
|
||||
trackball::setPointerSensitivity(tbSettings.pointerSensitivity);
|
||||
trackball::setEnabled(tbSettings.trackballEnabled);
|
||||
}
|
||||
lvgl_unlock();
|
||||
});
|
||||
void init_trackball() {
|
||||
auto tbSettings = tt::settings::trackball::loadOrGetDefault();
|
||||
lvgl_lock();
|
||||
if (trackball::init() != nullptr) {
|
||||
trackball::setMode(tbSettings.trackballMode == tt::settings::trackball::TrackballMode::Pointer
|
||||
? trackball::Mode::Pointer
|
||||
: trackball::Mode::Encoder);
|
||||
trackball::setEncoderSensitivity(tbSettings.encoderSensitivity);
|
||||
trackball::setPointerSensitivity(tbSettings.pointerSensitivity);
|
||||
trackball::setEnabled(tbSettings.trackballEnabled);
|
||||
}
|
||||
lvgl_unlock();
|
||||
}
|
||||
|
||||
static error_t start() {
|
||||
LOG_I(TAG, LOG_MESSAGE_POWER_ON_START);
|
||||
|
||||
if (!tdeck_power_on()) {
|
||||
LOG_E(TAG, LOG_MESSAGE_POWER_ON_FAILED);
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
|
||||
// Avoids crash when no SD card is inserted. It's unknown why, but likely is related to power draw.
|
||||
tt::kernel::delayMillis(100);
|
||||
delay_millis(100);
|
||||
|
||||
subscribe_events();
|
||||
tdeck_boot_splash_subscription = tt::kernel::subscribeSystemEvent(tt::kernel::SystemEvent::BootSplash, [](tt::kernel::SystemEvent event) {
|
||||
init_trackball();
|
||||
});
|
||||
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
static error_t stop() {
|
||||
tt::kernel::unsubscribeSystemEvent(tdeck_boot_splash_subscription);
|
||||
tdeck_boot_splash_subscription = tt::kernel::NoSystemEventSubscription;
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
@@ -77,8 +59,6 @@ Module lilygo_tdeck_plus_module = {
|
||||
.name = "lilygo-tdeck-plus",
|
||||
.start = start,
|
||||
.stop = stop,
|
||||
.symbols = nullptr,
|
||||
.internal = nullptr
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user