Update apps

This commit is contained in:
Willy-JL
2023-05-29 08:51:00 +01:00
parent 75b939ac76
commit 4e38f7fd54
11 changed files with 39 additions and 49 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

View File

@@ -1,8 +1,8 @@
#include "ifttt_virtual_button.h"
#define IFTTT_FOLDER "/ext/ifttt"
#define IFTTT_CONFIG_FOLDER "/ext/ifttt/config"
const char* CONFIG_FILE_PATH = "/ext/ifttt/config/config.settings";
#define IFTTT_FOLDER "/ext/apps_data/ifttt"
#define IFTTT_CONFIG_FOLDER "/ext/apps_data/ifttt/config"
const char* CONFIG_FILE_PATH = "/ext/apps_data/ifttt/config/config.settings";
#define FLIPPERZERO_SERIAL_BAUD 115200
typedef enum ESerialCommand { ESerialCommand_Config } ESerialCommand;
@@ -46,16 +46,11 @@ Settings* load_settings() {
Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* file = flipper_format_file_alloc(storage);
FuriString* string_value;
string_value = furi_string_alloc();
FuriString* text_ssid_value;
text_ssid_value = furi_string_alloc();
FuriString* text_password_value;
text_password_value = furi_string_alloc();
FuriString* text_key_value;
text_key_value = furi_string_alloc();
FuriString* text_event_value;
text_event_value = furi_string_alloc();
FuriString* string_value = furi_string_alloc();
FuriString* text_ssid_value = furi_string_alloc();
FuriString* text_password_value = furi_string_alloc();
FuriString* text_key_value = furi_string_alloc();
FuriString* text_event_value = furi_string_alloc();
if(storage_common_stat(storage, CONFIG_FILE_PATH, NULL) != FSE_OK) {
if(flipper_format_file_open_new(file, CONFIG_FILE_PATH)) {

View File

@@ -40,14 +40,15 @@ typedef struct {
} PluginEvent;
typedef struct {
FuriMutex* mutex;
bool dpad;
int row;
int column;
FuriMutex* mutex;
} Coleco;
static void render_callback(Canvas* const canvas, void* context) {
Coleco* coleco = (Coleco*)context;
furi_assert(context);
Coleco* coleco = context;
furi_mutex_acquire(coleco->mutex, FuriWaitForever);
if(coleco->dpad) {
@@ -174,20 +175,12 @@ static Coleco* coleco_alloc() {
coleco->row = 0;
coleco->column = 1;
coleco->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
if(!coleco->mutex) {
FURI_LOG_E("Coleco", "cannot create mutex\r\n");
free(coleco);
return NULL;
}
return coleco;
}
static void coleco_free(Coleco* coleco) {
furi_assert(coleco);
furi_mutex_free(coleco->mutex);
free(coleco);
}
@@ -197,7 +190,11 @@ int32_t coleco_app(void* p) {
FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(PluginEvent));
Coleco* coleco = coleco_alloc();
if(coleco == NULL) {
coleco->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
if(!coleco->mutex) {
FURI_LOG_E("Coleco", "cannot create mutex\r\n");
coleco_free(coleco);
return 255;
}
@@ -349,8 +346,6 @@ int32_t coleco_app(void* p) {
view_port_update(view_port);
}
} else {
FURI_LOG_D("Coleco", "FuriMessageQueue: event timeout");
}
furi_mutex_release(coleco->mutex);
@@ -363,6 +358,7 @@ int32_t coleco_app(void* p) {
furi_record_close("gui");
view_port_free(view_port);
furi_message_queue_free(event_queue);
furi_mutex_free(coleco->mutex);
coleco_free(coleco);
return 0;
}

View File

@@ -1,4 +0,0 @@
This is part of the official `SubGhz` app from [flipperzero-firmware](https://github.com/flipperdevices/flipperzero-firmware/tree/3217f286f03da119398586daf94c0723d28b872a/applications/main/subghz)
With changes from [unleashed-firmware
](https://github.com/DarkFlippers/unleashed-firmware/tree/3eac6ccd48a3851cf5d63bf7899b387a293e5319/applications/main/subghz)

View File

@@ -1236,7 +1236,7 @@ int32_t tanks_game_app(void* p) {
tanks_state->menu_state = MenuStateCooperativeServerMode;
}
} else if(tanks_state->state == GameStateCooperativeClient) {
FuriString* goesUp = NULL;
FuriString* goesUp = furi_string_alloc();
char arr[2];
arr[0] = GoesUp;
arr[1] = 0;
@@ -1246,7 +1246,7 @@ int32_t tanks_game_app(void* p) {
subghz_txrx,
(uint8_t*)furi_string_get_cstr(goesUp),
strlen(furi_string_get_cstr(goesUp)));
furi_string_free(goesUp);
} else {
tanks_state->p1->moving = true;
tanks_state->p1->direction = DirectionUp;
@@ -1260,7 +1260,7 @@ int32_t tanks_game_app(void* p) {
tanks_state->menu_state = MenuStateCooperativeClientMode;
}
} else if(tanks_state->state == GameStateCooperativeClient) {
FuriString* goesDown = NULL;
FuriString* goesDown = furi_string_alloc();
char arr[2];
arr[0] = GoesDown;
arr[1] = 0;
@@ -1270,6 +1270,7 @@ int32_t tanks_game_app(void* p) {
subghz_txrx,
(uint8_t*)furi_string_get_cstr(goesDown),
strlen(furi_string_get_cstr(goesDown)));
furi_string_free(goesDown);
} else {
tanks_state->p1->moving = true;
tanks_state->p1->direction = DirectionDown;
@@ -1277,7 +1278,7 @@ int32_t tanks_game_app(void* p) {
break;
case InputKeyRight:
if(tanks_state->state == GameStateCooperativeClient) {
FuriString* goesRight = NULL;
FuriString* goesRight = furi_string_alloc();
char arr[2];
arr[0] = GoesRight;
arr[1] = 0;
@@ -1287,6 +1288,7 @@ int32_t tanks_game_app(void* p) {
subghz_txrx,
(uint8_t*)furi_string_get_cstr(goesRight),
strlen(furi_string_get_cstr(goesRight)));
furi_string_free(goesRight);
} else {
tanks_state->p1->moving = true;
tanks_state->p1->direction = DirectionRight;
@@ -1294,7 +1296,7 @@ int32_t tanks_game_app(void* p) {
break;
case InputKeyLeft:
if(tanks_state->state == GameStateCooperativeClient) {
FuriString* goesLeft = NULL;
FuriString* goesLeft = furi_string_alloc();
char arr[2];
arr[0] = GoesLeft;
arr[1] = 0;
@@ -1304,6 +1306,7 @@ int32_t tanks_game_app(void* p) {
subghz_txrx,
(uint8_t*)furi_string_get_cstr(goesLeft),
strlen(furi_string_get_cstr(goesLeft)));
furi_string_free(goesLeft);
} else {
tanks_state->p1->moving = true;
tanks_state->p1->direction = DirectionLeft;
@@ -1327,7 +1330,7 @@ int32_t tanks_game_app(void* p) {
} else if(tanks_state->state == GameStateGameOver) {
tanks_game_init_game(tanks_state, tanks_state->state);
} else if(tanks_state->state == GameStateCooperativeClient) {
FuriString* shoots = NULL;
FuriString* shoots = furi_string_alloc();
char arr[2];
arr[0] = Shoots;
arr[1] = 0;
@@ -1337,6 +1340,7 @@ int32_t tanks_game_app(void* p) {
subghz_txrx,
(uint8_t*)furi_string_get_cstr(shoots),
strlen(furi_string_get_cstr(shoots)));
furi_string_free(shoots);
} else {
tanks_state->p1->shooting = true;
}
@@ -1385,7 +1389,7 @@ int32_t tanks_game_app(void* p) {
tanks_game_process_game_step(tanks_state);
FuriString* serializedData = NULL;
FuriString* serializedData = furi_string_alloc();
unsigned char* data = tanks_game_serialize(tanks_state);
char arr[11 * 16 + 1];
@@ -1401,7 +1405,7 @@ int32_t tanks_game_app(void* p) {
subghz_txrx,
(uint8_t*)furi_string_get_cstr(serializedData),
strlen(furi_string_get_cstr(serializedData)));
furi_string_free(serializedData);
tanks_state->sent++;
} else if(tanks_state->state == GameStateSingle) {
tanks_game_process_game_step(tanks_state);

View File

@@ -398,7 +398,7 @@ int32_t zeitraffer_app(void* p) {
}
if(!flipper_format_write_comment_cstr(
save,
"Zeitraffer app settings: of frames, interval time, backlight type, Delay")) {
"Zeitraffer app settings: n of frames, interval time, backlight type, Delay")) {
notification_message(notifications, &sequence_error);
break;
}

View File

@@ -33,7 +33,7 @@ void wifi_deauther_scene_console_output_on_enter(void* context) {
furi_string_reset(app->text_box_store);
app->text_box_store_strlen = 0;
if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
const char* help_msg = "For app support/feedback,\nreach out to\n";
const char* help_msg = "No help here\nonly pain\n";
furi_string_cat_str(app->text_box_store, help_msg);
app->text_box_store_strlen += strlen(help_msg);
}
@@ -43,9 +43,9 @@ void wifi_deauther_scene_console_output_on_enter(void* context) {
furi_string_cat_str(app->text_box_store, help_msg);
app->text_box_store_strlen += strlen(help_msg);
}
} else { // "View Log" menu action
text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store));
}
// "View Log" menu action
text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store));
scene_manager_set_scene_state(app->scene_manager, WifideautherSceneConsoleOutput, 0);
view_dispatcher_switch_to_view(app->view_dispatcher, WifideautherAppViewConsoleOutput);

View File

@@ -8,8 +8,9 @@
struct WifideautherUart {
WifideautherApp* app;
FuriHalUartId channel;
FuriThread* rx_thread;
StreamBufferHandle_t rx_stream;
FuriStreamBuffer* rx_stream;
uint8_t rx_buf[RX_BUF_SIZE + 1];
void (*handle_rx_data_cb)(uint8_t* buf, size_t len, void* context);
};
@@ -30,12 +31,10 @@ void wifi_deauther_uart_set_handle_rx_data_cb(
void wifi_deauther_uart_on_irq_cb(UartIrqEvent ev, uint8_t data, void* context) {
WifideautherUart* uart = (WifideautherUart*)context;
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
if(ev == UartIrqEventRXNE) {
xStreamBufferSendFromISR(uart->rx_stream, &data, 1, &xHigherPriorityTaskWoken);
furi_stream_buffer_send(uart->rx_stream, &data, 1, 0);
furi_thread_flags_set(furi_thread_get_id(uart->rx_thread), WorkerEvtRxDone);
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
}
}
@@ -48,14 +47,14 @@ static int32_t uart_worker(void* context) {
furi_check((events & FuriFlagError) == 0);
if(events & WorkerEvtStop) break;
if(events & WorkerEvtRxDone) {
size_t len = xStreamBufferReceive(uart->rx_stream, uart->rx_buf, RX_BUF_SIZE, 0);
size_t len = furi_stream_buffer_receive(uart->rx_stream, uart->rx_buf, RX_BUF_SIZE, 0);
if(len > 0) {
if(uart->handle_rx_data_cb) uart->handle_rx_data_cb(uart->rx_buf, len, uart->app);
}
}
}
vStreamBufferDelete(uart->rx_stream);
furi_stream_buffer_free(uart->rx_stream);
return 0;
}
@@ -68,7 +67,7 @@ WifideautherUart* wifi_deauther_uart_init(WifideautherApp* app) {
WifideautherUart* uart = malloc(sizeof(WifideautherUart));
uart->app = app;
uart->rx_stream = xStreamBufferCreate(RX_BUF_SIZE, 1);
uart->rx_stream = furi_stream_buffer_alloc(RX_BUF_SIZE, 1);
uart->rx_thread = furi_thread_alloc();
furi_thread_set_name(uart->rx_thread, "WifideautherUartRxThread");
furi_thread_set_stack_size(uart->rx_thread, 1024);