mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
GUI: Ascii input for ByteInput
This commit is contained in:
@@ -89,6 +89,7 @@
|
||||
- OFW: Dolphin: Happy mode in Desktop settings (by @portasynthinca3)
|
||||
- OFW: CLI: Improvements part I, `neofetch` command (by @portasynthinca3), fix for lab.flipper.net (by @xMasterX)
|
||||
- GUI:
|
||||
- ByteInput supports ASCII input (by @Willy-JL)
|
||||
- OFW: Add up and down button drawing functions to GUI elements (by @DerSkythe)
|
||||
- OFW: Extended icon draw function in Canvas (by @RebornedBrain)
|
||||
- OFW: RPC: Support 5V on GPIO control for ext. modules (by @gsurkov)
|
||||
|
||||
@@ -726,6 +726,51 @@ static bool byte_input_view_input_callback(InputEvent* event, void* context) {
|
||||
return consumed;
|
||||
}
|
||||
|
||||
static bool byte_input_view_ascii_callback(AsciiEvent* event, void* context) {
|
||||
ByteInput* byte_input = context;
|
||||
furi_assert(byte_input);
|
||||
|
||||
switch(event->value) {
|
||||
case AsciiValueDC3: // Right
|
||||
case AsciiValueDC4: // Left
|
||||
with_view_model(
|
||||
byte_input->view,
|
||||
ByteInputModel * model,
|
||||
{
|
||||
if(event->value == AsciiValueDC3) {
|
||||
byte_input_inc_selected_byte_mini(model);
|
||||
} else {
|
||||
byte_input_dec_selected_byte_mini(model);
|
||||
}
|
||||
},
|
||||
true);
|
||||
return true;
|
||||
default: // Look in keyboard
|
||||
for(size_t r = 0; r < keyboard_row_count; r++) {
|
||||
const ByteInputKey* row = byte_input_get_row(r);
|
||||
uint8_t size = byte_input_get_row_size(r);
|
||||
for(size_t key = 0; key < size; key++) {
|
||||
char value = row[key].value;
|
||||
if(event->value == value) {
|
||||
with_view_model(
|
||||
byte_input->view,
|
||||
ByteInputModel * model,
|
||||
{
|
||||
model->selected_row = r;
|
||||
model->selected_column = key;
|
||||
byte_input_handle_ok(model);
|
||||
},
|
||||
true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Reset all input-related data in model
|
||||
*
|
||||
* @param model The model
|
||||
@@ -747,6 +792,7 @@ ByteInput* byte_input_alloc(void) {
|
||||
view_allocate_model(byte_input->view, ViewModelTypeLocking, sizeof(ByteInputModel));
|
||||
view_set_draw_callback(byte_input->view, byte_input_view_draw_callback);
|
||||
view_set_input_callback(byte_input->view, byte_input_view_input_callback);
|
||||
view_set_ascii_callback(byte_input->view, byte_input_view_ascii_callback);
|
||||
|
||||
with_view_model(
|
||||
byte_input->view,
|
||||
|
||||
Reference in New Issue
Block a user