diff --git a/Readme.md b/Readme.md index 72ba5f1..015ff4d 100644 --- a/Readme.md +++ b/Readme.md @@ -2,7 +2,18 @@ es: FlipperZero | Guía de definitiva para compilar apps en FlipperZero +## In this new version: + +es: En esta nueva versión: + +`beta: 3.0.0` + +Users can now longpress and shortpress with an indicator on the screen. + +es: Los usuarios ahora pueden mantener presionado y presionar brevemente con un indicador en la pantalla. + - [FlipperZero | Ultimate compile guide](#flipperzero--ultimate-compile-guide) + - [In this new version:](#in-this-new-version) - [Installation](#installation) - [Create the app](#create-the-app) - [Code](#code) diff --git a/my_first_app/application.fam b/my_first_app/application.fam index 6e148a4..9a50e39 100644 --- a/my_first_app/application.fam +++ b/my_first_app/application.fam @@ -6,4 +6,4 @@ App( requires=["gui"], stack_size=1 * 1024, fap_category="Examples", -) \ No newline at end of file +) diff --git a/my_first_app/my_first_app.c b/my_first_app/my_first_app.c index 2d68bce..f21094a 100644 --- a/my_first_app/my_first_app.c +++ b/my_first_app/my_first_app.c @@ -35,26 +35,29 @@ static void handleInput(InputEvent* input_event, void* context) { FuriMessageQueue* event_queue = context; furi_assert(event_queue != NULL); + // Check if the button was long-pressed or not + bool longPress = (input_event->type == InputTypeLong) ? true : false; + // Change the message depending on which key was pressed switch(input_event->key) { case InputKeyUp: - message = "You pressed UP!"; + message = longPress ? "You long-pressed ^^^" : "You pressed ^"; break; case InputKeyDown: - message = "You pressed DOWN!"; + message = longPress ? "You long-pressed vvv" : "You pressed v"; break; case InputKeyLeft: - message = "You pressed LEFT!"; + message = longPress ? "You long-pressed <<<" : "You pressed <"; break; case InputKeyRight: - message = "You pressed RIGHT!"; + message = longPress ? "You long-pressed >>>" : "You pressed >"; break; case InputKeyOk: - message = "You pressed CENTER!"; + message = longPress ? "You long-pressed ooo" : "You pressed o"; break; case InputKeyBack: - message = "You pressed BACK!"; - exitMessage = "Long press to exit."; // Add this line + message = longPress ? "You long-pressed ---" : "You pressed -"; + exitMessage = longPress ? "Exiting the App." : "Long press to exit."; break; default: message = "Press any button..."; diff --git a/other/build/my_first_app.fap b/other/build/my_first_app.fap index def2422..45ecb7b 100644 Binary files a/other/build/my_first_app.fap and b/other/build/my_first_app.fap differ