Merge develop into main (#167)

- WiFi Connect app is now hidden by default, but accessible at the bottom of the WiFi Manage app when WiFi is turned on.
- WiFi service now turns on WiFi when calling connect() and WiFi is not on.
- Removed `blocking` option for `service::loader::startApp()`. This feature was unused and complex.
- Various apps: Moved private headers into Private/ folder.
- Various apps: created start() function for easy starting.
- Added documentation to all TactilityC APIs
- Refactored various `enum` into `class enum`
- Refactor M5Stack `initBoot()` (but VBus is still 0V for some reason)
This commit is contained in:
Ken Van Hoeylandt
2025-01-17 19:37:42 +01:00
committed by GitHub
parent 3ca0f8cf97
commit 3ea02d912f
147 changed files with 1538 additions and 739 deletions
@@ -20,13 +20,13 @@ struct Wifi {
~Wifi() = default;
/** @brief Locking mechanism for modifying the Wifi instance */
Mutex mutex = Mutex(Mutex::TypeRecursive);
Mutex mutex = Mutex(Mutex::Type::Recursive);
/** @brief The public event bus */
std::shared_ptr<PubSub> pubsub = std::make_shared<PubSub>();
/** @brief The internal message queue */
bool scan_active = false;
bool secure_connection = false;
WifiRadioState radio_state = WIFI_RADIO_CONNECTION_ACTIVE;
RadioState radio_state = RadioState::ConnectionActive;
};
@@ -34,8 +34,8 @@ static Wifi* wifi = nullptr;
// region Static
static void publish_event_simple(Wifi* wifi, WifiEventType type) {
WifiEvent turning_on_event = {.type = type};
static void publish_event_simple(Wifi* wifi, EventType type) {
Event turning_on_event = { .type = type };
tt_pubsub_publish(wifi->pubsub, &turning_on_event);
}
@@ -48,7 +48,7 @@ std::shared_ptr<PubSub> getPubsub() {
return wifi->pubsub;
}
WifiRadioState getRadioState() {
RadioState getRadioState() {
return wifi->radio_state;
}
@@ -80,31 +80,31 @@ void setScanRecords(uint16_t records) {
// TODO: implement
}
std::vector<WifiApRecord> getScanResults() {
std::vector<ApRecord> getScanResults() {
tt_check(wifi);
std::vector<WifiApRecord> records;
records.push_back((WifiApRecord) {
std::vector<ApRecord> records;
records.push_back((ApRecord) {
.ssid = "Home Wifi",
.rssi = -30,
.auth_mode = WIFI_AUTH_WPA2_PSK
});
records.push_back((WifiApRecord) {
records.push_back((ApRecord) {
.ssid = "No place like 127.0.0.1",
.rssi = -67,
.auth_mode = WIFI_AUTH_WPA2_PSK
});
records.push_back((WifiApRecord) {
records.push_back((ApRecord) {
.ssid = "Pretty fly for a Wi-Fi",
.rssi = -70,
.auth_mode = WIFI_AUTH_WPA2_PSK
});
records.push_back((WifiApRecord) {
records.push_back((ApRecord) {
.ssid = "An AP with a really, really long name",
.rssi = -80,
.auth_mode = WIFI_AUTH_WPA2_PSK
});
records.push_back((WifiApRecord) {
records.push_back((ApRecord) {
.ssid = "Bad Reception",
.rssi = -90,
.auth_mode = WIFI_AUTH_OPEN
@@ -116,10 +116,10 @@ std::vector<WifiApRecord> getScanResults() {
void setEnabled(bool enabled) {
tt_assert(wifi != nullptr);
if (enabled) {
wifi->radio_state = WIFI_RADIO_ON;
wifi->radio_state = RadioState::On;
wifi->secure_connection = true;
} else {
wifi->radio_state = WIFI_RADIO_OFF;
wifi->radio_state = RadioState::Off;
}
}
@@ -128,7 +128,7 @@ bool isConnectionSecure() {
}
int getRssi() {
if (wifi->radio_state == WIFI_RADIO_CONNECTION_ACTIVE) {
if (wifi->radio_state == RadioState::ConnectionActive) {
return -30;
} else {
return 0;