iButton fix data layout (#953)
* ibutton: fix info and delete scenes layout * loader: fix incorrect heap allocation memory calc * ibutton: cleanup
This commit is contained in:
parent
c77c6c30a2
commit
1d31000516
@ -14,14 +14,14 @@ void iButtonSceneDeleteConfirm::on_enter(iButtonApp* app) {
|
|||||||
|
|
||||||
app->set_text_store("\e#Delete %s?\e#", key->get_name());
|
app->set_text_store("\e#Delete %s?\e#", key->get_name());
|
||||||
widget_add_text_box_element(
|
widget_add_text_box_element(
|
||||||
widget, 0, 0, 128, 23, AlignCenter, AlignCenter, app->get_text_store());
|
widget, 0, 0, 128, 27, AlignCenter, AlignCenter, app->get_text_store());
|
||||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Back", callback, app);
|
widget_add_button_element(widget, GuiButtonTypeLeft, "Back", callback, app);
|
||||||
widget_add_button_element(widget, GuiButtonTypeRight, "Delete", callback, app);
|
widget_add_button_element(widget, GuiButtonTypeRight, "Delete", callback, app);
|
||||||
|
|
||||||
switch(key->get_key_type()) {
|
switch(key->get_key_type()) {
|
||||||
case iButtonKeyType::KeyDallas:
|
case iButtonKeyType::KeyDallas:
|
||||||
app->set_text_store(
|
app->set_text_store(
|
||||||
"%02X %02X %02X %02X %02X %02X %02X %02X\nDallas",
|
"%02X %02X %02X %02X %02X %02X %02X %02X",
|
||||||
key_data[0],
|
key_data[0],
|
||||||
key_data[1],
|
key_data[1],
|
||||||
key_data[2],
|
key_data[2],
|
||||||
@ -30,17 +30,23 @@ void iButtonSceneDeleteConfirm::on_enter(iButtonApp* app) {
|
|||||||
key_data[5],
|
key_data[5],
|
||||||
key_data[6],
|
key_data[6],
|
||||||
key_data[7]);
|
key_data[7]);
|
||||||
|
widget_add_string_element(
|
||||||
|
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Dallas");
|
||||||
break;
|
break;
|
||||||
case iButtonKeyType::KeyCyfral:
|
case iButtonKeyType::KeyCyfral:
|
||||||
app->set_text_store("%02X %02X\nCyfral", key_data[0], key_data[1]);
|
app->set_text_store("%02X %02X", key_data[0], key_data[1]);
|
||||||
|
widget_add_string_element(
|
||||||
|
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Cyfral");
|
||||||
break;
|
break;
|
||||||
case iButtonKeyType::KeyMetakom:
|
case iButtonKeyType::KeyMetakom:
|
||||||
app->set_text_store(
|
app->set_text_store(
|
||||||
"%02X %02X %02X %02X\nMetakom", key_data[0], key_data[1], key_data[2], key_data[3]);
|
"%02X %02X %02X %02X", key_data[0], key_data[1], key_data[2], key_data[3]);
|
||||||
|
widget_add_string_element(
|
||||||
|
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Metakom");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
widget_add_string_multiline_element(
|
widget_add_string_element(
|
||||||
widget, 64, 23, AlignCenter, AlignTop, FontSecondary, app->get_text_store());
|
widget, 64, 33, AlignCenter, AlignBottom, FontSecondary, app->get_text_store());
|
||||||
|
|
||||||
view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewWidget);
|
view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewWidget);
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,13 @@ void iButtonSceneInfo::on_enter(iButtonApp* app) {
|
|||||||
|
|
||||||
app->set_text_store("%s", key->get_name());
|
app->set_text_store("%s", key->get_name());
|
||||||
widget_add_text_box_element(
|
widget_add_text_box_element(
|
||||||
widget, 0, 0, 128, 23, AlignCenter, AlignCenter, app->get_text_store());
|
widget, 0, 0, 128, 27, AlignCenter, AlignCenter, app->get_text_store());
|
||||||
widget_add_button_element(widget, GuiButtonTypeLeft, "Back", callback, app);
|
widget_add_button_element(widget, GuiButtonTypeLeft, "Back", callback, app);
|
||||||
|
|
||||||
switch(key->get_key_type()) {
|
switch(key->get_key_type()) {
|
||||||
case iButtonKeyType::KeyDallas:
|
case iButtonKeyType::KeyDallas:
|
||||||
app->set_text_store(
|
app->set_text_store(
|
||||||
"\e#%02X %02X %02X %02X %02X %02X %02X %02X\e#\nDallas",
|
"%02X %02X %02X %02X %02X %02X %02X %02X",
|
||||||
key_data[0],
|
key_data[0],
|
||||||
key_data[1],
|
key_data[1],
|
||||||
key_data[2],
|
key_data[2],
|
||||||
@ -29,21 +29,23 @@ void iButtonSceneInfo::on_enter(iButtonApp* app) {
|
|||||||
key_data[5],
|
key_data[5],
|
||||||
key_data[6],
|
key_data[6],
|
||||||
key_data[7]);
|
key_data[7]);
|
||||||
|
widget_add_string_element(
|
||||||
|
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Dallas");
|
||||||
break;
|
break;
|
||||||
case iButtonKeyType::KeyMetakom:
|
case iButtonKeyType::KeyMetakom:
|
||||||
app->set_text_store(
|
app->set_text_store(
|
||||||
"\e#%02X %02X %02X %02X\e#\nMetakom",
|
"%02X %02X %02X %02X", key_data[0], key_data[1], key_data[2], key_data[3]);
|
||||||
key_data[0],
|
widget_add_string_element(
|
||||||
key_data[1],
|
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Metakom");
|
||||||
key_data[2],
|
|
||||||
key_data[3]);
|
|
||||||
break;
|
break;
|
||||||
case iButtonKeyType::KeyCyfral:
|
case iButtonKeyType::KeyCyfral:
|
||||||
app->set_text_store("\e#%02X %02X\e#\nCyfral", key_data[0], key_data[1]);
|
app->set_text_store("%02X %02X", key_data[0], key_data[1]);
|
||||||
|
widget_add_string_element(
|
||||||
|
widget, 64, 45, AlignCenter, AlignBottom, FontSecondary, "Cyfral");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
widget_add_text_box_element(
|
widget_add_string_element(
|
||||||
widget, 0, 23, 128, 40, AlignCenter, AlignTop, app->get_text_store());
|
widget, 64, 33, AlignCenter, AlignBottom, FontPrimary, app->get_text_store());
|
||||||
|
|
||||||
view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewWidget);
|
view_manager->switch_to(iButtonAppViewManager::Type::iButtonAppViewWidget);
|
||||||
}
|
}
|
||||||
|
@ -217,9 +217,11 @@ static void loader_thread_state_callback(FuriThreadState thread_state, void* con
|
|||||||
LoaderEvent event;
|
LoaderEvent event;
|
||||||
|
|
||||||
if(thread_state == FuriThreadStateRunning) {
|
if(thread_state == FuriThreadStateRunning) {
|
||||||
instance->free_heap_size = memmgr_get_free_heap();
|
|
||||||
event.type = LoaderEventTypeApplicationStarted;
|
event.type = LoaderEventTypeApplicationStarted;
|
||||||
furi_pubsub_publish(loader_instance->pubsub, &event);
|
furi_pubsub_publish(loader_instance->pubsub, &event);
|
||||||
|
|
||||||
|
// Snapshot current memory usage
|
||||||
|
instance->free_heap_size = memmgr_get_free_heap();
|
||||||
} else if(thread_state == FuriThreadStateStopped) {
|
} else if(thread_state == FuriThreadStateStopped) {
|
||||||
/*
|
/*
|
||||||
* Current Leak Sanitizer assumes that memory is allocated and freed
|
* Current Leak Sanitizer assumes that memory is allocated and freed
|
||||||
@ -240,6 +242,7 @@ static void loader_thread_state_callback(FuriThreadState thread_state, void* con
|
|||||||
furi_thread_get_heap_size(instance->thread));
|
furi_thread_get_heap_size(instance->thread));
|
||||||
furi_hal_power_insomnia_exit();
|
furi_hal_power_insomnia_exit();
|
||||||
loader_unlock(instance);
|
loader_unlock(instance);
|
||||||
|
|
||||||
event.type = LoaderEventTypeApplicationStopped;
|
event.type = LoaderEventTypeApplicationStopped;
|
||||||
furi_pubsub_publish(loader_instance->pubsub, &event);
|
furi_pubsub_publish(loader_instance->pubsub, &event);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user