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
@@ -25,7 +25,7 @@ State AppInstance::getState() const {
|
||||
* Consider not exposing bundle, but expose `app_get_bundle_int(key)` methods with locking in it.
|
||||
*/
|
||||
const AppManifest& AppInstance::getManifest() const {
|
||||
tt_assert(manifest != nullptr);
|
||||
assert(manifest != nullptr);
|
||||
return *manifest;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ std::shared_ptr<const Bundle> AppInstance::getParameters() const {
|
||||
}
|
||||
|
||||
std::unique_ptr<Paths> AppInstance::getPaths() const {
|
||||
tt_assert(manifest != nullptr);
|
||||
assert(manifest != nullptr);
|
||||
return std::make_unique<AppInstancePaths>(*manifest);
|
||||
}
|
||||
|
||||
|
||||
@@ -188,8 +188,8 @@ bool registerElfApp(const std::string& filePath) {
|
||||
|
||||
std::shared_ptr<App> createElfApp(const std::shared_ptr<AppManifest>& manifest) {
|
||||
TT_LOG_I(TAG, "createElfApp");
|
||||
tt_assert(manifest != nullptr);
|
||||
tt_assert(manifest->location.isExternal());
|
||||
assert(manifest != nullptr);
|
||||
assert(manifest->location.isExternal());
|
||||
return std::make_shared<ElfApp>(manifest->location.getPath());
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ private:
|
||||
|
||||
static void onButtonClickedCallback(lv_event_t* e) {
|
||||
auto appContext = service::loader::getCurrentAppContext();
|
||||
tt_assert(appContext != nullptr);
|
||||
assert(appContext != nullptr);
|
||||
auto app = std::static_pointer_cast<AlertDialogApp>(appContext->getApp());
|
||||
app->onButtonClicked(e);
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ private:
|
||||
kernel::systemEventPublish(kernel::SystemEvent::BootSplash);
|
||||
|
||||
auto* lvgl_display = lv_display_get_default();
|
||||
tt_assert(lvgl_display != nullptr);
|
||||
assert(lvgl_display != nullptr);
|
||||
auto* hal_display = (hal::Display*)lv_display_get_user_data(lvgl_display);
|
||||
tt_assert(hal_display != nullptr);
|
||||
assert(hal_display != nullptr);
|
||||
if (hal_display->supportsBacklightDuty()) {
|
||||
int32_t backlight_duty = app::display::getBacklightDuty();
|
||||
hal_display->setBacklightDuty(backlight_duty);
|
||||
|
||||
@@ -24,9 +24,9 @@ static uint8_t gamma = 255;
|
||||
static void onBacklightSliderEvent(lv_event_t* event) {
|
||||
auto* slider = static_cast<lv_obj_t*>(lv_event_get_target(event));
|
||||
auto* lvgl_display = lv_display_get_default();
|
||||
tt_assert(lvgl_display != nullptr);
|
||||
assert(lvgl_display != nullptr);
|
||||
auto* hal_display = (tt::hal::Display*)lv_display_get_user_data(lvgl_display);
|
||||
tt_assert(hal_display != nullptr);
|
||||
assert(hal_display != nullptr);
|
||||
|
||||
if (hal_display->supportsBacklightDuty()) {
|
||||
int32_t slider_value = lv_slider_get_value(slider);
|
||||
@@ -41,9 +41,9 @@ static void onBacklightSliderEvent(lv_event_t* event) {
|
||||
static void onGammaSliderEvent(lv_event_t* event) {
|
||||
auto* slider = static_cast<lv_obj_t*>(lv_event_get_target(event));
|
||||
auto* lvgl_display = lv_display_get_default();
|
||||
tt_assert(lvgl_display != nullptr);
|
||||
assert(lvgl_display != nullptr);
|
||||
auto* hal_display = (tt::hal::Display*)lv_display_get_user_data(lvgl_display);
|
||||
tt_assert(hal_display != nullptr);
|
||||
assert(hal_display != nullptr);
|
||||
|
||||
if (hal_display->getGammaCurveCount() > 0) {
|
||||
int32_t slider_value = lv_slider_get_value(slider);
|
||||
@@ -57,9 +57,9 @@ static void onGammaSliderEvent(lv_event_t* event) {
|
||||
|
||||
static tt::hal::Display* getHalDisplay(lv_obj_t* widget) {
|
||||
auto* lvgl_display = lv_obj_get_display(widget);
|
||||
tt_assert(lvgl_display != nullptr);
|
||||
assert(lvgl_display != nullptr);
|
||||
auto* hal_display = (tt::hal::Display*)lv_display_get_user_data(lvgl_display);
|
||||
tt_assert(hal_display != nullptr);
|
||||
assert(hal_display != nullptr);
|
||||
return hal_display;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ class DisplayApp : public App {
|
||||
lv_obj_add_event_cb(gamma_slider, onGammaSliderEvent, LV_EVENT_VALUE_CHANGED, nullptr);
|
||||
|
||||
auto* hal_display = getHalDisplay(parent);
|
||||
tt_assert(hal_display != nullptr);
|
||||
assert(hal_display != nullptr);
|
||||
|
||||
if (!hal_display->supportsBacklightDuty()) {
|
||||
lv_slider_set_value(brightness_slider, 255, LV_ANIM_OFF);
|
||||
|
||||
@@ -101,7 +101,7 @@ void GpioApp::onTimer(TT_UNUSED std::shared_ptr<void> context) {
|
||||
|
||||
void GpioApp::startTask() {
|
||||
lock();
|
||||
tt_assert(timer == nullptr);
|
||||
assert(timer == nullptr);
|
||||
timer = std::make_unique<Timer>(
|
||||
Timer::Type::Periodic,
|
||||
&onTimer
|
||||
@@ -111,7 +111,7 @@ void GpioApp::startTask() {
|
||||
}
|
||||
|
||||
void GpioApp::stopTask() {
|
||||
tt_assert(timer);
|
||||
assert(timer);
|
||||
|
||||
timer->stop();
|
||||
timer = nullptr;
|
||||
|
||||
@@ -160,7 +160,7 @@ void I2cScannerApp::onScanTimerCallback(TT_UNUSED std::shared_ptr<void> context)
|
||||
bool I2cScannerApp::getPort(i2c_port_t* outPort) {
|
||||
if (mutex.acquire(100 / portTICK_PERIOD_MS) == TtStatusOk) {
|
||||
*outPort = this->port;
|
||||
tt_assert(mutex.release() == TtStatusOk);
|
||||
assert(mutex.release() == TtStatusOk);
|
||||
return true;
|
||||
} else {
|
||||
TT_LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "getPort");
|
||||
@@ -171,7 +171,7 @@ bool I2cScannerApp::getPort(i2c_port_t* outPort) {
|
||||
bool I2cScannerApp::addAddressToList(uint8_t address) {
|
||||
if (mutex.acquire(100 / portTICK_PERIOD_MS) == TtStatusOk) {
|
||||
scannedAddresses.push_back(address);
|
||||
tt_assert(mutex.release() == TtStatusOk);
|
||||
assert(mutex.release() == TtStatusOk);
|
||||
return true;
|
||||
} else {
|
||||
TT_LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "addAddressToList");
|
||||
@@ -257,7 +257,7 @@ void I2cScannerApp::startScanning() {
|
||||
}
|
||||
void I2cScannerApp::stopScanning() {
|
||||
if (mutex.acquire(250 / portTICK_PERIOD_MS) == TtStatusOk) {
|
||||
tt_assert(scanTimer != nullptr);
|
||||
assert(scanTimer != nullptr);
|
||||
scanState = ScanStateStopped;
|
||||
tt_check(mutex.release() == TtStatusOk);
|
||||
} else {
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
|
||||
static void onButtonClickedCallback(lv_event_t* e) {
|
||||
auto appContext = service::loader::getCurrentAppContext();
|
||||
tt_assert(appContext != nullptr);
|
||||
assert(appContext != nullptr);
|
||||
auto app = std::static_pointer_cast<InputDialogApp>(appContext->getApp());
|
||||
app->onButtonClicked(e);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ private:
|
||||
|
||||
static void onListItemSelectedCallback(lv_event_t* e) {
|
||||
auto appContext = service::loader::getCurrentAppContext();
|
||||
tt_assert(appContext != nullptr);
|
||||
assert(appContext != nullptr);
|
||||
auto app = std::static_pointer_cast<SelectionDialogApp>(appContext->getApp());
|
||||
app->onListItemSelected(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user