Fixes and improvements (#185)
- unPhone improvements related to power and boot (add boot count logging) - Cleanup of Mutex acquire/release - Removed `tt_assert()` in favour of `assert()` - Fix sim build (likely failed due to migration of GitHub Actions to Ubuntu 24.04)
This commit is contained in:
committed by
GitHub
parent
3be251d8fb
commit
d86dc40472
@@ -29,7 +29,7 @@ private:
|
||||
|
||||
void update() {
|
||||
auto sdcard = tt::hal::getConfiguration()->sdcard;
|
||||
tt_assert(sdcard);
|
||||
assert(sdcard);
|
||||
|
||||
if (lock(50)) {
|
||||
auto new_state = sdcard->getState();
|
||||
|
||||
@@ -312,7 +312,7 @@ bool isConnectionSecure() {
|
||||
}
|
||||
|
||||
int getRssi() {
|
||||
tt_assert(wifi_singleton);
|
||||
assert(wifi_singleton);
|
||||
static int rssi = 0;
|
||||
if (esp_wifi_sta_get_rssi(&rssi) == ESP_OK) {
|
||||
return rssi;
|
||||
@@ -326,7 +326,7 @@ int getRssi() {
|
||||
static void scan_list_alloc(std::shared_ptr<Wifi> wifi) {
|
||||
auto lockable = wifi->dataMutex.scoped();
|
||||
if (lockable->lock(TtWaitForever)) {
|
||||
tt_assert(wifi->scan_list == nullptr);
|
||||
assert(wifi->scan_list == nullptr);
|
||||
wifi->scan_list = static_cast<wifi_ap_record_t*>(malloc(sizeof(wifi_ap_record_t) * wifi->scan_list_limit));
|
||||
wifi->scan_list_count = 0;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ static void scan_list_alloc_safely(std::shared_ptr<Wifi> wifi) {
|
||||
static void scan_list_free(std::shared_ptr<Wifi> wifi) {
|
||||
auto lockable = wifi->dataMutex.scoped();
|
||||
if (lockable->lock(TtWaitForever)) {
|
||||
tt_assert(wifi->scan_list != nullptr);
|
||||
assert(wifi->scan_list != nullptr);
|
||||
free(wifi->scan_list);
|
||||
wifi->scan_list = nullptr;
|
||||
wifi->scan_list_count = 0;
|
||||
@@ -643,7 +643,7 @@ static void dispatchDisable(std::shared_ptr<void> context) {
|
||||
TT_LOG_E(TAG, "Failed to deinit");
|
||||
}
|
||||
|
||||
tt_assert(wifi->netif != nullptr);
|
||||
assert(wifi->netif != nullptr);
|
||||
esp_netif_destroy(wifi->netif);
|
||||
wifi->netif = nullptr;
|
||||
wifi->setScanActive(false);
|
||||
@@ -941,7 +941,7 @@ class WifiService final : public Service {
|
||||
public:
|
||||
|
||||
void onStart(ServiceContext& service) override {
|
||||
tt_assert(wifi_singleton == nullptr);
|
||||
assert(wifi_singleton == nullptr);
|
||||
wifi_singleton = std::make_shared<Wifi>();
|
||||
|
||||
wifi_singleton->autoConnectTimer = std::make_unique<Timer>(Timer::Type::Periodic, onAutoConnectTimer, wifi_singleton);
|
||||
@@ -956,7 +956,7 @@ public:
|
||||
|
||||
void onStop(ServiceContext& service) override {
|
||||
auto wifi = wifi_singleton;
|
||||
tt_assert(wifi != nullptr);
|
||||
assert(wifi != nullptr);
|
||||
|
||||
RadioState state = wifi->getRadioState();
|
||||
if (state != RadioState::Off) {
|
||||
|
||||
@@ -44,7 +44,7 @@ static void publish_event_simple(Wifi* wifi, EventType type) {
|
||||
// region Public functions
|
||||
|
||||
std::shared_ptr<PubSub> getPubsub() {
|
||||
tt_assert(wifi);
|
||||
assert(wifi);
|
||||
return wifi->pubsub;
|
||||
}
|
||||
|
||||
@@ -57,26 +57,26 @@ std::string getConnectionTarget() {
|
||||
}
|
||||
|
||||
void scan() {
|
||||
tt_assert(wifi);
|
||||
assert(wifi);
|
||||
wifi->scan_active = false; // TODO: enable and then later disable automatically
|
||||
}
|
||||
|
||||
bool isScanning() {
|
||||
tt_assert(wifi);
|
||||
assert(wifi);
|
||||
return wifi->scan_active;
|
||||
}
|
||||
|
||||
void connect(const settings::WifiApSettings* ap, bool remember) {
|
||||
tt_assert(wifi);
|
||||
assert(wifi);
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
void disconnect() {
|
||||
tt_assert(wifi);
|
||||
assert(wifi);
|
||||
}
|
||||
|
||||
void setScanRecords(uint16_t records) {
|
||||
tt_assert(wifi);
|
||||
assert(wifi);
|
||||
// TODO: implement
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ std::vector<ApRecord> getScanResults() {
|
||||
}
|
||||
|
||||
void setEnabled(bool enabled) {
|
||||
tt_assert(wifi != nullptr);
|
||||
assert(wifi != nullptr);
|
||||
if (enabled) {
|
||||
wifi->radio_state = RadioState::On;
|
||||
wifi->secure_connection = true;
|
||||
|
||||
Reference in New Issue
Block a user