Merge develop into main (#313)
- Add app path get() functions to `TactilityC` - Improved `Dispatcher` and `DispatcherThread` - Improved `PubSub` (type safety) - Created test for `DispatcherThread` and `PubSub` - Save properties files on app exit (various apps) by posting it to the main dispatcher (fixes UI hanging briefly on app exit) - Fixed bug with `SystemSettings` being read from the wrong file path. - `loadPropertiesFile()` now uses `file::readLines()` instead of doing that manually - Increased timer task stack size (required due to issues when reading a properties file for the very first time) - General cleanup - Created `EstimatedPower` driver that uses an ADC pin to measure voltage and estimate the battery charge that is left. - Cleanup of T-Deck board (updated to new style)
This commit is contained in:
committed by
GitHub
parent
5cc5b50694
commit
0f8380e8fe
@@ -1,13 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/app/AppManifest.h"
|
||||
|
||||
#include <Tactility/app/AppManifest.h>
|
||||
#include <Tactility/Dispatcher.h>
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/service/ServiceManifest.h>
|
||||
|
||||
namespace tt {
|
||||
|
||||
namespace app::launcher { extern const app::AppManifest manifest; }
|
||||
namespace app::launcher { extern const AppManifest manifest; }
|
||||
|
||||
/** @brief The configuration for the operating system
|
||||
* It contains the hardware configuration, apps and services
|
||||
@@ -33,4 +33,7 @@ void run(const Configuration& config);
|
||||
*/
|
||||
const Configuration* _Nullable getConfiguration();
|
||||
|
||||
|
||||
Dispatcher& getMainDispatcher();
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
#include "Tactility/hal/spi/Spi.h"
|
||||
#include "Tactility/hal/uart/Uart.h"
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
#include <Tactility/hal/spi/Spi.h>
|
||||
#include <Tactility/hal/uart/Uart.h>
|
||||
#include "i2c/I2c.h"
|
||||
|
||||
namespace tt::hal {
|
||||
|
||||
@@ -11,8 +11,6 @@ namespace tt::service::gps {
|
||||
|
||||
class GpsService final : public Service {
|
||||
|
||||
private:
|
||||
|
||||
struct GpsDeviceRecord {
|
||||
std::shared_ptr<hal::gps::GpsDevice> device = nullptr;
|
||||
hal::gps::GpsDevice::GgaSubscriptionId satelliteSubscriptionId = -1;
|
||||
@@ -25,7 +23,7 @@ private:
|
||||
Mutex mutex = Mutex(Mutex::Type::Recursive);
|
||||
Mutex stateMutex;
|
||||
std::vector<GpsDeviceRecord> deviceRecords;
|
||||
std::shared_ptr<PubSub> statePubSub = std::make_shared<PubSub>();
|
||||
std::shared_ptr<PubSub<State>> statePubSub = std::make_shared<PubSub<State>>();
|
||||
std::unique_ptr<Paths> paths;
|
||||
State state = State::Off;
|
||||
|
||||
@@ -46,8 +44,8 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
void onStart(tt::service::ServiceContext &serviceContext) final;
|
||||
void onStop(tt::service::ServiceContext &serviceContext) final;
|
||||
void onStart(ServiceContext &serviceContext) override;
|
||||
void onStop(ServiceContext &serviceContext) override;
|
||||
|
||||
bool addGpsConfiguration(hal::gps::GpsConfiguration configuration);
|
||||
bool removeGpsConfiguration(hal::gps::GpsConfiguration configuration);
|
||||
@@ -61,7 +59,7 @@ public:
|
||||
bool getCoordinates(minmea_sentence_rmc& rmc) const;
|
||||
|
||||
/** @return GPS service pubsub that broadcasts State* objects */
|
||||
std::shared_ptr<PubSub> getStatePubsub() const { return statePubSub; }
|
||||
std::shared_ptr<PubSub<State>> getStatePubsub() const { return statePubSub; }
|
||||
};
|
||||
|
||||
std::shared_ptr<GpsService> findGpsService();
|
||||
|
||||
@@ -11,15 +11,11 @@ namespace tt::service::loader {
|
||||
|
||||
// region LoaderEvent for PubSub
|
||||
|
||||
typedef enum {
|
||||
LoaderEventTypeApplicationStarted,
|
||||
LoaderEventTypeApplicationShowing,
|
||||
LoaderEventTypeApplicationHiding,
|
||||
LoaderEventTypeApplicationStopped
|
||||
} LoaderEventType;
|
||||
|
||||
struct LoaderEvent {
|
||||
LoaderEventType type;
|
||||
enum class LoaderEvent{
|
||||
ApplicationStarted,
|
||||
ApplicationShowing,
|
||||
ApplicationHiding,
|
||||
ApplicationStopped
|
||||
};
|
||||
|
||||
// endregion LoaderEvent for PubSub
|
||||
@@ -43,6 +39,6 @@ std::shared_ptr<app::App> _Nullable getCurrentApp();
|
||||
/**
|
||||
* @brief PubSub for LoaderEvent
|
||||
*/
|
||||
std::shared_ptr<PubSub> getPubsub();
|
||||
std::shared_ptr<PubSub<LoaderEvent>> getPubsub();
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -33,7 +33,7 @@ typedef enum {
|
||||
|
||||
namespace tt::service::wifi {
|
||||
|
||||
enum class EventType {
|
||||
enum class WifiEvent {
|
||||
/** Radio was turned on */
|
||||
RadioStateOn,
|
||||
/** Radio is turning on. */
|
||||
@@ -61,10 +61,6 @@ enum class RadioState {
|
||||
Off,
|
||||
};
|
||||
|
||||
struct Event {
|
||||
EventType type;
|
||||
};
|
||||
|
||||
struct ApRecord {
|
||||
std::string ssid;
|
||||
int8_t rssi;
|
||||
@@ -76,7 +72,7 @@ struct ApRecord {
|
||||
* @brief Get wifi pubsub that broadcasts Event objects
|
||||
* @return PubSub
|
||||
*/
|
||||
std::shared_ptr<PubSub> getPubsub();
|
||||
std::shared_ptr<PubSub<WifiEvent>> getPubsub();
|
||||
|
||||
/** @return Get the current radio state */
|
||||
RadioState getRadioState();
|
||||
|
||||
Reference in New Issue
Block a user