This commit is contained in:
VerstreuteSeele
2023-01-10 22:07:57 +01:00
2 changed files with 27 additions and 21 deletions
+26 -9
View File
@@ -16,6 +16,8 @@
#include <dialogs/dialogs.h>
#include "DAP_Link_icons.h"
#include "../../settings/desktop_settings/desktop_settings_app.h"
/***************************************************************************/
/****************************** DAP COMMON *********************************/
/***************************************************************************/
@@ -482,22 +484,37 @@ DapConfig* dap_app_get_config(DapApp* app) {
int32_t dap_link_app(void* p) {
UNUSED(p);
DesktopSettings* settings = malloc(sizeof(DesktopSettings));
DESKTOP_SETTINGS_LOAD(settings);
if(furi_hal_usb_is_locked()) {
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
DialogMessage* message = dialog_message_alloc();
dialog_message_set_header(message, "Connection\nis active!", 3, 2, AlignLeft, AlignTop);
dialog_message_set_text(
message,
"Disconnect from\nPC or phone to\nuse this function.",
3,
30,
AlignLeft,
AlignTop);
if (settings->sfw_mode) {
dialog_message_set_header(message, "Connection\nis active!", 3, 2, AlignLeft, AlignTop);
dialog_message_set_text(
message,
"Disconnect from\nPC or phone to\nuse this function.",
3,
30,
AlignLeft,
AlignTop);
}
else {
dialog_message_set_header(message, "I am not\na whore!", 3, 2, AlignLeft, AlignTop);
dialog_message_set_text(
message,
"Pull out from\nPC or phone to\nuse me like this.",
3,
30,
AlignLeft,
AlignTop);
}
dialog_message_set_icon(message, &I_ActiveConnection_50x64, 78, 0);
dialog_message_show(dialogs, message);
dialog_message_free(message);
furi_record_close(RECORD_DIALOGS);
free(settings);
return -1;
}
@@ -524,4 +541,4 @@ int32_t dap_link_app(void* p) {
dap_app_free(app);
return 0;
}
}
+1 -12
View File
@@ -6,7 +6,6 @@
#include <furi.h>
#include <gui/gui.h>
#include <input/input.h>
#include <notification/notification_messages.h>
#include <furi_hal_random.h>
#define SCREEN_SIZE_X 128
@@ -127,10 +126,6 @@ int32_t flipper_pong_app()
Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
if (players.ball_X_direction == 0) notification_message(notification, &sequence_set_only_red_255);
else notification_message(notification, &sequence_set_only_blue_255);
FuriTimer* timer = furi_timer_alloc(clock_tick, FuriTimerTypePeriodic, event_queue);
furi_timer_start(timer, 1000/FPS);
@@ -146,7 +141,6 @@ int32_t flipper_pong_app()
if(event.input.key == InputKeyBack)
{
release_mutex(&state_mutex, playersMutex);
notification_message(notification, &sequence_set_only_green_255);
break;
}
else if(event.input.key == InputKeyUp)
@@ -202,7 +196,6 @@ int32_t flipper_pong_app()
playersMutex->ball_X -= playersMutex->ball_X_speed;
playersMutex->ball_X_speed = changeSpeed();
playersMutex->ball_Y_speed = changeSpeed();
notification_message(notification, &sequence_set_only_red_255);
}
else if (insidePlayer2 == true)
{
@@ -210,7 +203,6 @@ int32_t flipper_pong_app()
playersMutex->ball_X += playersMutex->ball_X_speed;
playersMutex->ball_X_speed = changeSpeed();
playersMutex->ball_Y_speed = changeSpeed();
notification_message(notification, &sequence_set_only_blue_255);
}
else
{
@@ -229,7 +221,6 @@ int32_t flipper_pong_app()
playersMutex->ball_Y_speed = 1;
playersMutex->ball_X_direction = 0;
playersMutex->player2_score++;
notification_message(notification, &sequence_set_only_red_255);
}
}
else
@@ -246,7 +237,6 @@ int32_t flipper_pong_app()
playersMutex->ball_Y_speed = 1;
playersMutex->ball_X_direction = 1;
playersMutex->player1_score++;
notification_message(notification, &sequence_set_only_blue_255);
}
}
}
@@ -292,7 +282,6 @@ int32_t flipper_pong_app()
view_port_free(view_port);
furi_timer_free(timer);
furi_record_close(RECORD_GUI);
furi_record_close(RECORD_NOTIFICATION);
return 0;
}
}