New logging and more (#446)
- `TT_LOG_*` macros are replaced by `Logger` via `#include<Tactility/Logger.h>` - Changed default timezone to Europe/Amsterdam - Fix for logic bug in unPhone hardware - Fix for init/deinit in DRV2605 driver - Other fixes - Removed optimization that broke unPhone (disabled the moving of heap-related functions to flash)
This commit is contained in:
committed by
GitHub
parent
719f7bcece
commit
f620255c41
@@ -1,24 +1,20 @@
|
||||
#include <Tactility/network/HttpdReq.h>
|
||||
|
||||
#include <Tactility/app/wifimanage/View.h>
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/app/wifimanage/WifiManagePrivate.h>
|
||||
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/lvgl/Style.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/service/wifi/Wifi.h>
|
||||
#include <Tactility/service/wifi/WifiSettings.h>
|
||||
|
||||
#include <format>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <Tactility/service/wifi/WifiSettings.h>
|
||||
|
||||
namespace tt::app::wifimanage {
|
||||
|
||||
constexpr auto* TAG = "WifiManageView";
|
||||
static const auto LOGGER = Logger("WifiManageView");
|
||||
|
||||
std::shared_ptr<WifiManage> _Nullable optWifiManage();
|
||||
|
||||
@@ -70,16 +66,16 @@ static void onConnectToHiddenClicked(lv_event_t* event) {
|
||||
// region Secondary updates
|
||||
|
||||
void View::connect(lv_event_t* event) {
|
||||
TT_LOG_D(TAG, "connect()");
|
||||
LOGGER.debug("connect()");
|
||||
auto* widget = lv_event_get_current_target_obj(event);
|
||||
auto index = reinterpret_cast<size_t>(lv_obj_get_user_data(widget));
|
||||
auto* self = static_cast<View*>(lv_event_get_user_data(event));
|
||||
auto ap_records = self->state->getApRecords();
|
||||
|
||||
if (index < ap_records.size()) {
|
||||
TT_LOG_I(TAG, "Clicked %d/%d", index, ap_records.size() - 1);
|
||||
LOGGER.info("Clicked {}/{}", index, ap_records.size() - 1);
|
||||
auto& ssid = ap_records[index].ssid;
|
||||
TT_LOG_I(TAG, "Clicked AP: %s", ssid.c_str());
|
||||
LOGGER.info("Clicked AP: {}", ssid);
|
||||
std::string connection_target = service::wifi::getConnectionTarget();
|
||||
if (connection_target == ssid) {
|
||||
self->bindings->onDisconnect();
|
||||
@@ -87,12 +83,12 @@ void View::connect(lv_event_t* event) {
|
||||
self->bindings->onConnectSsid(ssid);
|
||||
}
|
||||
} else {
|
||||
TT_LOG_W(TAG, "Clicked AP: record %d/%d does not exist", index, ap_records.size() - 1);
|
||||
LOGGER.warn("Clicked AP: record {}/{} does not exist", index, ap_records.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void View::showDetails(lv_event_t* event) {
|
||||
TT_LOG_D(TAG, "showDetails()");
|
||||
LOGGER.debug("showDetails()");
|
||||
auto* widget = lv_event_get_current_target_obj(event);
|
||||
auto index = reinterpret_cast<size_t>(lv_obj_get_user_data(widget));
|
||||
auto* self = static_cast<View*>(lv_event_get_user_data(event));
|
||||
@@ -100,10 +96,10 @@ void View::showDetails(lv_event_t* event) {
|
||||
|
||||
if (index < ap_records.size()) {
|
||||
auto& ssid = ap_records[index].ssid;
|
||||
TT_LOG_I(TAG, "Clicked AP: %s", ssid.c_str());
|
||||
LOGGER.info("Clicked AP: {}", ssid);
|
||||
self->bindings->onShowApSettings(ssid);
|
||||
} else {
|
||||
TT_LOG_W(TAG, "Clicked AP: record %d/%d does not exist", index, ap_records.size() - 1);
|
||||
LOGGER.warn("Clicked AP: record {}/{} does not exist", index, ap_records.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,22 +4,24 @@
|
||||
#include <Tactility/app/AppContext.h>
|
||||
#include <Tactility/app/wifiapsettings/WifiApSettings.h>
|
||||
#include <Tactility/app/wificonnect/WifiConnect.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/LogMessages.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
|
||||
namespace tt::app::wifimanage {
|
||||
|
||||
constexpr auto TAG = "WifiManage";
|
||||
static const auto LOGGER = Logger("WifiManage");
|
||||
|
||||
extern const AppManifest manifest;
|
||||
|
||||
static void onConnect(const std::string& ssid) {
|
||||
service::wifi::settings::WifiApSettings settings;
|
||||
if (service::wifi::settings::load(ssid, settings)) {
|
||||
TT_LOG_I(TAG, "Connecting with known credentials");
|
||||
LOGGER.info("Connecting with known credentials");
|
||||
service::wifi::connect(settings, false);
|
||||
} else {
|
||||
TT_LOG_I(TAG, "Starting connection dialog");
|
||||
LOGGER.info("Starting connection dialog");
|
||||
wificonnect::start(ssid);
|
||||
}
|
||||
}
|
||||
@@ -65,7 +67,7 @@ void WifiManage::requestViewUpdate() {
|
||||
view.update();
|
||||
lvgl::unlock();
|
||||
} else {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
||||
LOGGER.error(LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "LVGL");
|
||||
}
|
||||
}
|
||||
unlock();
|
||||
@@ -73,7 +75,7 @@ void WifiManage::requestViewUpdate() {
|
||||
|
||||
void WifiManage::onWifiEvent(service::wifi::WifiEvent event) {
|
||||
auto radio_state = service::wifi::getRadioState();
|
||||
TT_LOG_I(TAG, "Update with state %s", service::wifi::radioStateToString(radio_state));
|
||||
LOGGER.info("Update with state {}", service::wifi::radioStateToString(radio_state));
|
||||
getState().setRadioState(radio_state);
|
||||
switch (event) {
|
||||
using enum service::wifi::WifiEvent;
|
||||
@@ -118,7 +120,7 @@ void WifiManage::onShow(AppContext& app, lv_obj_t* parent) {
|
||||
bool can_scan = radio_state == service::wifi::RadioState::On ||
|
||||
radio_state == service::wifi::RadioState::ConnectionPending ||
|
||||
radio_state == service::wifi::RadioState::ConnectionActive;
|
||||
TT_LOG_I(TAG, "%s %d", service::wifi::radioStateToString(radio_state), (int)service::wifi::isScanning());
|
||||
LOGGER.info("{} {}", service::wifi::radioStateToString(radio_state), service::wifi::isScanning());
|
||||
if (can_scan && !service::wifi::isScanning()) {
|
||||
service::wifi::scan();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user