Code cleanup

This commit is contained in:
jl1990
2023-05-02 18:36:06 +02:00
parent 38ba334a1a
commit 4fb63eb36b
50 changed files with 118 additions and 118 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ void AccessorApp::run(void) {
exit = switch_to_previous_scene();
}
}
};
}
scenes[current_scene]->on_exit(this);
@@ -17,7 +17,7 @@ static void draw_stat(Canvas* canvas, int x, int y, const Icon* icon, char* val)
canvas_draw_box(canvas, x - 4, y + 16, 24, 6);
canvas_set_color(canvas, ColorBlack);
canvas_draw_str_aligned(canvas, x + 8, y + 22, AlignCenter, AlignBottom, val);
};
}
static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
char emote[20] = {};
@@ -85,7 +85,7 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
canvas_draw_str_aligned(canvas, 92, y + 3, AlignCenter, AlignCenter, emote);
canvas_draw_str_aligned(canvas, 92, y + 15, AlignCenter, AlignCenter, header);
canvas_draw_str_aligned(canvas, 92, y + 27, AlignCenter, AlignCenter, value);
};
}
static void battery_info_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
+1 -1
View File
@@ -34,4 +34,4 @@ private:
} // namespace cardboard
#endif // CARDBOARD_SDK_UTIL_MATRIX4X4_H_
#endif // CARDBOARD_SDK_UTIL_MATRIX_4X4_H_
+9 -9
View File
@@ -174,7 +174,7 @@ static void avr_isp_commit(AvrIsp* instance, uint16_t addr, uint8_t data) {
while((furi_get_tick() - starttime) < 30) {
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FLASH_HI(addr)) != 0xFF) {
break;
};
}
}
}
}
@@ -357,7 +357,7 @@ uint8_t avr_isp_read_lock_byte(AvrIsp* instance) {
data = avr_isp_spi_transaction(instance, AVR_ISP_READ_LOCK_BYTE);
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_LOCK_BYTE) == data) {
break;
};
}
data = 0x00;
}
return data;
@@ -377,7 +377,7 @@ bool avr_isp_write_lock_byte(AvrIsp* instance, uint8_t lock) {
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_LOCK_BYTE) == lock) {
ret = true;
break;
};
}
}
}
return ret;
@@ -392,7 +392,7 @@ uint8_t avr_isp_read_fuse_low(AvrIsp* instance) {
data = avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_LOW);
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_LOW) == data) {
break;
};
}
data = 0x00;
}
return data;
@@ -412,7 +412,7 @@ bool avr_isp_write_fuse_low(AvrIsp* instance, uint8_t lfuse) {
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_LOW) == lfuse) {
ret = true;
break;
};
}
}
}
return ret;
@@ -427,7 +427,7 @@ uint8_t avr_isp_read_fuse_high(AvrIsp* instance) {
data = avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_HIGH);
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_HIGH) == data) {
break;
};
}
data = 0x00;
}
return data;
@@ -447,7 +447,7 @@ bool avr_isp_write_fuse_high(AvrIsp* instance, uint8_t hfuse) {
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_HIGH) == hfuse) {
ret = true;
break;
};
}
}
}
return ret;
@@ -462,7 +462,7 @@ uint8_t avr_isp_read_fuse_extended(AvrIsp* instance) {
data = avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_EXTENDED);
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_EXTENDED) == data) {
break;
};
}
data = 0x00;
}
return data;
@@ -482,7 +482,7 @@ bool avr_isp_write_fuse_extended(AvrIsp* instance, uint8_t efuse) {
if(avr_isp_spi_transaction(instance, AVR_ISP_READ_FUSE_EXTENDED) == efuse) {
ret = true;
break;
};
}
}
}
return ret;
@@ -111,7 +111,7 @@ static uint8_t avr_isp_prog_getch(AvrIspProg* instance) {
uint8_t data[1] = {0};
while(furi_stream_buffer_receive(instance->stream_rx, &data, sizeof(int8_t), 30) == 0) {
if(instance->exit) break;
};
}
return data[0];
}
@@ -348,7 +348,7 @@ static void avr_isp_prog_commit(AvrIspProg* instance, uint16_t addr, uint8_t dat
while((furi_get_tick() - starttime) < 30) {
if(avr_isp_prog_spi_transaction(instance, AVR_ISP_READ_FLASH_HI(addr)) != 0xFF) {
break;
};
}
}
}
}
+2 -2
View File
@@ -98,7 +98,7 @@ const char* get_error_code_name(ErrorCode error_code) {
return "OK";
default:
return "Unknown Code";
};
}
}
const char* get_error_code_message(ErrorCode error_code) {
@@ -121,5 +121,5 @@ const char* get_error_code_message(ErrorCode error_code) {
return "OK";
default:
return "Could not read barcode data";
};
}
}
+1 -1
View File
@@ -111,7 +111,7 @@ void rShift() {
memset((tmp + stackSize) - BF_STACK_STEP_SIZE, 0x00, BF_STACK_STEP_SIZE);
bfStack = (uint8_t*)tmp;
};
}
if(stackPtr > stackSizeReal) {
stackSizeReal = stackPtr;
}
+1 -1
View File
@@ -199,7 +199,7 @@ void generate_calculator_layout(Canvas* canvas) {
canvas_draw_str(canvas, 19, 118, " 0");
canvas_draw_str(canvas, 35, 118, " .");
canvas_draw_str(canvas, 51, 118, " =");
};
}
void calculator_draw_callback(Canvas* canvas, void* ctx) {
furi_assert(ctx);
+1 -1
View File
@@ -393,7 +393,7 @@ bool music_player_worker_load_rtttl_from_file(MusicPlayerWorker* instance, const
if(!storage_file_open(file, file_path, FSAM_READ, FSOM_OPEN_EXISTING)) {
FURI_LOG_E(TAG, "Unable to open file");
break;
};
}
uint16_t ret = 0;
do {
@@ -356,7 +356,7 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
stream_rewind(context->uids_stream);
end_of_list = true;
break;
};
}
if(furi_string_get_char(context->data_str, 0) == '#') continue;
if(furi_string_size(context->data_str) != 11) break;
break;
@@ -370,7 +370,7 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
notification_message(context->notify, &sequence_blink_stop);
notification_message(context->notify, &sequence_error);
break;
};
}
// string is valid, parse it in context->payload
for(uint8_t i = 0; i < 5; i++) {
@@ -394,7 +394,7 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
stream_rewind(context->uids_stream);
end_of_list = true;
break;
};
}
if(furi_string_get_char(context->data_str, 0) == '#') continue;
if(furi_string_size(context->data_str) != 9) break;
break;
@@ -408,7 +408,7 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
notification_message(context->notify, &sequence_blink_stop);
notification_message(context->notify, &sequence_error);
break;
};
}
// string is valid, parse it in context->payload
for(uint8_t i = 0; i < 4; i++) {
+1 -1
View File
@@ -163,7 +163,7 @@ static bool hex_viewer_open_file(HexViewer* hex_viewer, const char* file_path) {
FURI_LOG_E(TAG, "Unable to open stream: %s", file_path);
isOk = false;
break;
};
}
hex_viewer->model->file_size = stream_size(hex_viewer->model->stream);
} while(false);
@@ -242,7 +242,7 @@ void ibtnfuzzer_scene_run_attack_on_tick(iBtnFuzzerState* context) {
stream_rewind(context->uids_stream);
end_of_list = true;
break;
};
}
if(furi_string_get_char(context->data_str, 0) == '#') continue;
if(furi_string_size(context->data_str) != 17) break;
break;
@@ -256,7 +256,7 @@ void ibtnfuzzer_scene_run_attack_on_tick(iBtnFuzzerState* context) {
notification_message(context->notify, &sequence_blink_stop);
notification_message(context->notify, &sequence_error);
break;
};
}
// string is valid, parse it in context->payload
for(uint8_t i = 0; i < 8; i++) {
@@ -280,7 +280,7 @@ void ibtnfuzzer_scene_run_attack_on_tick(iBtnFuzzerState* context) {
stream_rewind(context->uids_stream);
end_of_list = true;
break;
};
}
if(furi_string_get_char(context->data_str, 0) == '#') continue;
if(furi_string_size(context->data_str) != 5) break;
break;
@@ -294,7 +294,7 @@ void ibtnfuzzer_scene_run_attack_on_tick(iBtnFuzzerState* context) {
notification_message(context->notify, &sequence_blink_stop);
notification_message(context->notify, &sequence_error);
break;
};
}
// string is valid, parse it in context->payload
for(uint8_t i = 0; i < 2; i++) {
@@ -318,7 +318,7 @@ void ibtnfuzzer_scene_run_attack_on_tick(iBtnFuzzerState* context) {
stream_rewind(context->uids_stream);
end_of_list = true;
break;
};
}
if(furi_string_get_char(context->data_str, 0) == '#') continue;
if(furi_string_size(context->data_str) != 9) break;
break;
@@ -332,7 +332,7 @@ void ibtnfuzzer_scene_run_attack_on_tick(iBtnFuzzerState* context) {
notification_message(context->notify, &sequence_blink_stop);
notification_message(context->notify, &sequence_error);
break;
};
}
// string is valid, parse it in context->payload
for(uint8_t i = 0; i < 4; i++) {
+1 -1
View File
@@ -139,7 +139,7 @@ void send_serial_command_config(ESerialCommand command, Settings* settings) {
break;
default:
return;
};
}
furi_hal_uart_tx(FuriHalUartIdUSART1, data, 1);
}
+1 -1
View File
@@ -38,7 +38,7 @@ void send_serial_command_send(ESerialCommand command) {
break;
default:
return;
};
}
furi_hal_uart_tx(FuriHalUartIdUSART1, data, 1);
}
+1 -1
View File
@@ -178,7 +178,7 @@ static void timer_callback(void* ctx) {
case Silent:
break;
}
};
}
// this is a bit of a kludge... if we are on vibro and unpronounced, stop vibro after half the usual duration
switch(metronome_state->output_mode) {
+1 -1
View File
@@ -399,7 +399,7 @@ bool music_beeper_worker_load_rtttl_from_file(MusicBeeperWorker* instance, const
if(!storage_file_open(file, file_path, FSAM_READ, FSOM_OPEN_EXISTING)) {
FURI_LOG_E(TAG, "Unable to open file");
break;
};
}
uint16_t ret = 0;
do {
+1 -1
View File
@@ -397,7 +397,7 @@ bool music_player_worker_load_rtttl_from_file(MusicPlayerWorker* instance, const
if(!storage_file_open(file, file_path, FSAM_READ, FSOM_OPEN_EXISTING)) {
FURI_LOG_E(TAG, "Unable to open file");
break;
};
}
uint16_t ret = 0;
do {
+1 -1
View File
@@ -48,7 +48,7 @@ FuriHalNfcReturn rfalPicoPassPollerInitialize(void) {
FuriHalNfcModePollPicopass, FuriHalNfcBitrate26p48, FuriHalNfcBitrate26p48);
if(ret != FuriHalNfcReturnOk) {
return ret;
};
}
furi_hal_nfc_ll_set_error_handling(FuriHalNfcErrorHandlingNfc);
furi_hal_nfc_ll_set_guard_time(FURI_HAL_NFC_LL_GT_PICOPASS);
+1 -1
View File
@@ -131,7 +131,7 @@ void pcsg_hopper_update(POCSAGPagerApp* app) {
if(app->txrx->txrx_state == PCSGTxRxStateRx) {
pcsg_rx_end(app);
};
}
if(app->txrx->txrx_state == PCSGTxRxStateIDLE) {
subghz_receiver_reset(app->txrx->receiver);
app->txrx->preset->frequency =
@@ -133,7 +133,7 @@ void pocsag_pager_scene_receiver_on_enter(void* context) {
if(app->txrx->txrx_state == PCSGTxRxStateRx) {
pcsg_rx_end(app);
};
}
if((app->txrx->txrx_state == PCSGTxRxStateIDLE) ||
(app->txrx->txrx_state == PCSGTxRxStateSleep)) {
pcsg_begin(
@@ -158,7 +158,7 @@ bool pocsag_pager_scene_receiver_on_event(void* context, SceneManagerEvent event
if(app->txrx->txrx_state == PCSGTxRxStateRx) {
pcsg_rx_end(app);
pcsg_sleep(app);
};
}
app->txrx->hopper_state = PCSGHopperStateOFF;
app->txrx->idx_menu_chosen = 0;
subghz_receiver_set_rx_callback(app->txrx->receiver, NULL, app);
+6 -6
View File
@@ -9,14 +9,14 @@ static bool flipp_pomodoro_app_back_event_callback(void* ctx) {
furi_assert(ctx);
FlippPomodoroApp* app = ctx;
return scene_manager_handle_back_event(app->scene_manager);
};
}
static void flipp_pomodoro_app_tick_event_callback(void* ctx) {
furi_assert(ctx);
FlippPomodoroApp* app = ctx;
scene_manager_handle_custom_event(app->scene_manager, FlippPomodoroAppCustomEventTimerTick);
};
}
static bool flipp_pomodoro_app_custom_event_callback(void* ctx, uint32_t event) {
furi_assert(ctx);
@@ -40,7 +40,7 @@ static bool flipp_pomodoro_app_custom_event_callback(void* ctx, uint32_t event)
break;
}
return scene_manager_handle_custom_event(app->scene_manager, event);
};
}
FlippPomodoroApp* flipp_pomodoro_app_alloc() {
FlippPomodoroApp* app = malloc(sizeof(FlippPomodoroApp));
@@ -71,7 +71,7 @@ FlippPomodoroApp* flipp_pomodoro_app_alloc() {
scene_manager_next_scene(app->scene_manager, FlippPomodoroSceneTimer);
return app;
};
}
void flipp_pomodoro_app_free(FlippPomodoroApp* app) {
view_dispatcher_remove_view(app->view_dispatcher, FlippPomodoroAppViewTimer);
@@ -81,7 +81,7 @@ void flipp_pomodoro_app_free(FlippPomodoroApp* app) {
free(app);
furi_record_close(RECORD_GUI);
furi_record_close(RECORD_NOTIFICATION);
};
}
int32_t flipp_pomodoro_app(void* p) {
UNUSED(p);
@@ -92,4 +92,4 @@ int32_t flipp_pomodoro_app(void* p) {
flipp_pomodoro_app_free(app);
return 0;
};
}
+2 -2
View File
@@ -7,7 +7,7 @@ const int TIME_MINUTES_IN_HOUR = 60;
uint32_t time_now() {
return furi_hal_rtc_get_timestamp();
};
}
TimeDifference time_difference_seconds(uint32_t begin, uint32_t end) {
const uint32_t duration_seconds = end - begin;
@@ -17,4 +17,4 @@ TimeDifference time_difference_seconds(uint32_t begin, uint32_t end) {
return (
TimeDifference){.total_seconds = duration_seconds, .minutes = minutes, .seconds = seconds};
};
}
+9 -9
View File
@@ -38,22 +38,22 @@ void flipp_pomodoro__toggle_stage(FlippPomodoroState* state) {
furi_assert(state);
state->current_stage_index = state->current_stage_index + 1;
state->started_at_timestamp = time_now();
};
}
PomodoroStage flipp_pomodoro__get_stage(FlippPomodoroState* state) {
furi_assert(state);
return flipp_pomodoro__stage_by_index(state->current_stage_index);
};
}
char* flipp_pomodoro__current_stage_label(FlippPomodoroState* state) {
furi_assert(state);
return current_stage_label[flipp_pomodoro__get_stage(state)];
};
}
char* flipp_pomodoro__next_stage_label(FlippPomodoroState* state) {
furi_assert(state);
return next_stage_label[flipp_pomodoro__stage_by_index(state->current_stage_index + 1)];
};
}
uint32_t flipp_pomodoro__current_stage_total_duration(FlippPomodoroState* state) {
const int32_t stage_duration_seconds_map[] = {
@@ -63,22 +63,22 @@ uint32_t flipp_pomodoro__current_stage_total_duration(FlippPomodoroState* state)
};
return stage_duration_seconds_map[flipp_pomodoro__get_stage(state)];
};
}
uint32_t flipp_pomodoro__stage_expires_timestamp(FlippPomodoroState* state) {
return state->started_at_timestamp + flipp_pomodoro__current_stage_total_duration(state);
};
}
TimeDifference flipp_pomodoro__stage_remaining_duration(FlippPomodoroState* state) {
const uint32_t stage_ends_at = flipp_pomodoro__stage_expires_timestamp(state);
return time_difference_seconds(time_now(), stage_ends_at);
};
}
bool flipp_pomodoro__is_stage_expired(FlippPomodoroState* state) {
const uint32_t expired_by = flipp_pomodoro__stage_expires_timestamp(state);
const uint8_t seamless_change_span_seconds = 1;
return (time_now() - seamless_change_span_seconds) >= expired_by;
};
}
FlippPomodoroState* flipp_pomodoro__new() {
FlippPomodoroState* state = malloc(sizeof(FlippPomodoroState));
@@ -86,4 +86,4 @@ FlippPomodoroState* flipp_pomodoro__new() {
state->started_at_timestamp = now;
state->current_stage_index = 0;
return state;
};
}
@@ -15,7 +15,7 @@ void flipp_pomodoro_scene_timer_sync_view_state(void* ctx) {
flipp_pomodoro_view_timer_set_state(
flipp_pomodoro_view_timer_get_view(app->timer_view), app->state);
};
}
void flipp_pomodoro_scene_timer_on_next_stage(void* ctx) {
furi_assert(ctx);
@@ -23,7 +23,7 @@ void flipp_pomodoro_scene_timer_on_next_stage(void* ctx) {
FlippPomodoroApp* app = ctx;
view_dispatcher_send_custom_event(app->view_dispatcher, FlippPomodoroAppCustomEventStageSkip);
};
}
void flipp_pomodoro_scene_timer_on_enter(void* ctx) {
furi_assert(ctx);
@@ -34,7 +34,7 @@ void flipp_pomodoro_scene_timer_on_enter(void* ctx) {
flipp_pomodoro_scene_timer_sync_view_state(app);
flipp_pomodoro_view_timer_set_on_right_cb(
app->timer_view, flipp_pomodoro_scene_timer_on_next_stage, app);
};
}
void flipp_pomodoro_scene_timer_handle_custom_event(
FlippPomodoroApp* app,
@@ -48,7 +48,7 @@ void flipp_pomodoro_scene_timer_handle_custom_event(
if(custom_event == FlippPomodoroAppCustomEventStateUpdated) {
flipp_pomodoro_scene_timer_sync_view_state(app);
}
};
}
bool flipp_pomodoro_scene_timer_on_event(void* ctx, SceneManagerEvent event) {
furi_assert(ctx);
@@ -62,10 +62,10 @@ bool flipp_pomodoro_scene_timer_on_event(void* ctx, SceneManagerEvent event) {
return ExitSignal;
default:
break;
};
}
return SceneEventNotConusmed;
};
}
void flipp_pomodoro_scene_timer_on_exit(void* ctx) {
UNUSED(ctx);
};
}
@@ -58,7 +58,7 @@ static void
remaining_stage_time_string);
furi_string_free(timer_string);
};
}
static void draw_str_with_drop_shadow(
Canvas* canvas,
@@ -92,7 +92,7 @@ static void
static void flipp_pomodoro_view_timer_draw_callback(Canvas* canvas, void* _model) {
if(!_model) {
return;
};
}
FlippPomodoroTimerViewModel* model = _model;
@@ -109,7 +109,7 @@ static void flipp_pomodoro_view_timer_draw_callback(Canvas* canvas, void* _model
canvas_set_font(canvas, FontSecondary);
elements_button_right(canvas, flipp_pomodoro__next_stage_label(model->state));
};
}
bool flipp_pomodoro_view_timer_input_callback(InputEvent* event, void* ctx) {
furi_assert(ctx);
@@ -125,15 +125,15 @@ bool flipp_pomodoro_view_timer_input_callback(InputEvent* event, void* ctx) {
furi_assert(timer->right_cb_ctx);
timer->right_cb(timer->right_cb_ctx);
return ViewInputConsumed;
};
}
return ViewInputNotConusmed;
};
}
View* flipp_pomodoro_view_timer_get_view(FlippPomodoroTimerView* timer) {
furi_assert(timer);
return timer->view;
};
}
void flipp_pomodoro_view_timer_assign_animation(View* view) {
with_view_model(
@@ -162,7 +162,7 @@ FlippPomodoroTimerView* flipp_pomodoro_view_timer_alloc() {
view_set_input_callback(timer->view, flipp_pomodoro_view_timer_input_callback);
return timer;
};
}
void flipp_pomodoro_view_timer_set_on_right_cb(
FlippPomodoroTimerView* timer,
@@ -172,7 +172,7 @@ void flipp_pomodoro_view_timer_set_on_right_cb(
furi_assert(right_cb_ctx);
timer->right_cb = right_cb;
timer->right_cb_ctx = right_cb_ctx;
};
}
void flipp_pomodoro_view_timer_set_state(View* view, FlippPomodoroState* state) {
furi_assert(view);
@@ -180,7 +180,7 @@ void flipp_pomodoro_view_timer_set_state(View* view, FlippPomodoroState* state)
with_view_model(
view, FlippPomodoroTimerViewModel * model, { model->state = state; }, false);
flipp_pomodoro_view_timer_assign_animation(view);
};
}
void flipp_pomodoro_view_timer_free(FlippPomodoroTimerView* timer) {
furi_assert(timer);
@@ -192,4 +192,4 @@ void flipp_pomodoro_view_timer_free(FlippPomodoroTimerView* timer) {
view_free(timer->view);
free(timer);
};
}
@@ -63,7 +63,7 @@ static void draw_callback(Canvas* canvas, void* ctx) {
elements_button_center(canvas, "New");
elements_button_left(canvas, notifications_enabled ? "On" : "Off");
};
}
static void input_callback(InputEvent* input_event, void* ctx) {
furi_assert(ctx);
+1 -1
View File
@@ -3945,7 +3945,7 @@ void STM32SAM::Code41240() {
Insert(pos + 1, index + 1, phonemeLengthTable[index + 1], stress[pos]);
Insert(pos + 2, index + 2, phonemeLengthTable[index + 2], stress[pos]);
pos += 3;
};
}
}
// Rewrites the phonemes using the following rules:
+1 -1
View File
@@ -157,7 +157,7 @@ static bool text_viewer_open_file(TextViewer* text_viewer, const char* file_path
FURI_LOG_E(TAG, "Unable to open stream: %s", file_path);
isOk = false;
break;
};
}
text_viewer->model->file_size = stream_size(text_viewer->model->stream);
} while(false);
+1 -1
View File
@@ -25,4 +25,4 @@ TOTP_ROLL_VALUE_FN(int8_t, int8_t)
TOTP_ROLL_VALUE_FN(uint8_t, int8_t)
TOTP_ROLL_VALUE_FN(size_t, int16_t);
TOTP_ROLL_VALUE_FN(size_t, int16_t)
+1 -1
View File
@@ -11,7 +11,7 @@ const char* format_text(FormatTag tag) {
default:
return "Unknown";
}
};
}
struct WavParser {
WavHeaderChunk header;
@@ -133,7 +133,7 @@ void weather_station_scene_receiver_on_enter(void* context) {
if(app->txrx->txrx_state == WSTxRxStateRx) {
ws_rx_end(app);
};
}
if((app->txrx->txrx_state == WSTxRxStateIDLE) || (app->txrx->txrx_state == WSTxRxStateSleep)) {
ws_begin(
app,
@@ -157,7 +157,7 @@ bool weather_station_scene_receiver_on_event(void* context, SceneManagerEvent ev
if(app->txrx->txrx_state == WSTxRxStateRx) {
ws_rx_end(app);
ws_sleep(app);
};
}
app->txrx->hopper_state = WSHopperStateOFF;
app->txrx->idx_menu_chosen = 0;
subghz_receiver_set_rx_callback(app->txrx->receiver, NULL, app);
@@ -146,7 +146,7 @@ void ws_hopper_update(WeatherStationApp* app) {
if(app->txrx->txrx_state == WSTxRxStateRx) {
ws_rx_end(app);
};
}
if(app->txrx->txrx_state == WSTxRxStateIDLE) {
subghz_receiver_reset(app->txrx->receiver);
app->txrx->preset->frequency =
@@ -258,7 +258,7 @@ int32_t fap_loader_app(char* p) {
if(fap_loader_run_selected_app(loader, false)) {
fap_loader_run_selected_app(loader, true);
}
};
}
}
fap_loader_free(loader);
+4 -4
View File
@@ -31,7 +31,7 @@ static void ibutton_cli_print_usage() {
printf("\tCyfral (2 bytes key_data)\r\n");
printf("\tMetakom (4 bytes key_data), must contain correct parity\r\n");
printf("\t<key_data> are hex-formatted\r\n");
};
}
static bool ibutton_cli_parse_key(iButtonProtocols* protocols, iButtonKey* key, FuriString* args) {
bool result = false;
@@ -124,7 +124,7 @@ static void ibutton_cli_read(Cli* cli) {
ibutton_protocols_free(protocols);
furi_event_flag_free(event);
};
}
typedef struct {
FuriEventFlag* event;
@@ -216,7 +216,7 @@ void ibutton_cli_emulate(Cli* cli, FuriString* args) {
while(!cli_cmd_interrupt_received(cli)) {
furi_delay_ms(100);
};
}
} while(false);
@@ -226,7 +226,7 @@ void ibutton_cli_emulate(Cli* cli, FuriString* args) {
ibutton_key_free(key);
ibutton_worker_free(worker);
ibutton_protocols_free(protocols);
};
}
void ibutton_cli(Cli* cli, FuriString* args, void* context) {
UNUSED(cli);
+1 -1
View File
@@ -30,7 +30,7 @@ static void lfrfid_cli_print_usage() {
printf("rfid raw_read <ask | psk> <filename>\r\n");
printf("rfid raw_emulate <filename>\r\n");
printf("rfid raw_analyze <filename>\r\n");
};
}
typedef struct {
ProtocolId protocol;
+1 -1
View File
@@ -21,7 +21,7 @@ void onewire_on_system_start() {
static void onewire_cli_print_usage() {
printf("Usage:\r\n");
printf("onewire search\r\n");
};
}
static void onewire_cli_search(Cli* cli) {
UNUSED(cli);
@@ -152,7 +152,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
subghz_rx_end(subghz);
subghz_sleep(subghz);
};
}
//Stop save file
subghz_protocol_raw_save_to_file_stop(
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result);
@@ -196,7 +196,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
subghz_rx_end(subghz);
subghz_sleep(subghz);
};
}
subghz->state_notifications = SubGhzNotificationStateIDLE;
consumed = true;
break;
@@ -305,7 +305,7 @@ bool subghz_scene_read_raw_on_event(void* context, SceneManagerEvent event) {
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
subghz_rx_end(subghz);
subghz_sleep(subghz);
};
}
size_t spl_count = subghz_protocol_raw_get_sample_write(
(SubGhzProtocolDecoderRAW*)subghz->txrx->decoder_result);
@@ -439,7 +439,7 @@ void subghz_scene_read_raw_on_exit(void* context) {
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
subghz_rx_end(subghz);
subghz_sleep(subghz);
};
}
subghz->state_notifications = SubGhzNotificationStateIDLE;
notification_message(subghz->notifications, &sequence_reset_rgb);
+1 -1
View File
@@ -603,7 +603,7 @@ void subghz_hopper_update(SubGhz* subghz) {
if(subghz->txrx->txrx_state == SubGhzTxRxStateRx) {
subghz_rx_end(subghz);
};
}
if(subghz->txrx->txrx_state == SubGhzTxRxStateIDLE) {
subghz_receiver_reset(subghz->txrx->receiver);
subghz->txrx->preset->frequency = subghz_setting_get_hopper_frequency(
+1 -1
View File
@@ -79,7 +79,7 @@ void cli_command_help(Cli* cli, FuriString* args, void* context) {
printf("%s", furi_string_get_cstr(*CliCommandTree_ref(it_right)->key_ptr));
CliCommandTree_next(it_right);
}
};
}
if(furi_string_size(args) > 0) {
cli_nl();
+1 -1
View File
@@ -15,7 +15,7 @@ void crypto_cli_print_usage() {
printf("\thas_key <key_slot:int>\t - Check if secure enclave has key in slot\r\n");
printf(
"\tstore_key <key_slot:int> <key_type:str> <key_size:int> <key_data:hex>\t - Store key in secure enclave. !!! NON-REVERSIBLE OPERATION - READ MANUAL FIRST !!!\r\n");
};
}
void crypto_cli_encrypt(Cli* cli, FuriString* args) {
int key_slot = 0;
@@ -101,7 +101,7 @@ bool dolphin_state_is_levelup(int icounter) {
if((icounter == DOLPHIN_LEVELS[i])) {
return true;
}
};
}
return false;
}
+1 -1
View File
@@ -99,7 +99,7 @@ void popup_start_timer(void* context) {
if(furi_timer_start(popup->timer, timer_period) != FuriStatusOk) {
furi_assert(0);
};
}
}
}
+1 -1
View File
@@ -85,7 +85,7 @@ static void text_box_insert_endline(Canvas* canvas, TextBoxModel* model) {
// Set text position to 5th line from the end
for(uint8_t i = 0; i < line_num - 5; i++) {
while(*model->text_pos++ != '\n') {
};
}
}
model->scroll_num = line_num - 4;
model->scroll_pos = line_num - 5;
@@ -36,7 +36,7 @@ void notification_message_save_settings(NotificationApp* app) {
furi_event_flag_wait(
m.back_event, NOTIFICATION_EVENT_COMPLETE, FuriFlagWaitAny, FuriWaitForever);
furi_event_flag_free(m.back_event);
};
}
// internal layer
void notification_apply_internal_led_layer(NotificationLedLayer* layer, uint8_t layer_value) {
@@ -336,7 +336,7 @@ void notification_process_notification_message(
}
notification_message_index++;
notification_message = (*message->sequence)[notification_message_index];
};
}
// send and do minimal delay
if(led_active) {
@@ -447,7 +447,7 @@ static bool notification_load_settings(NotificationApp* app) {
furi_record_close(RECORD_STORAGE);
return fs_result;
};
}
static bool notification_save_settings(NotificationApp* app) {
NotificationSettings settings;
@@ -482,7 +482,7 @@ static bool notification_save_settings(NotificationApp* app) {
furi_record_close(RECORD_STORAGE);
return fs_result;
};
}
static void input_event_callback(const void* value, void* context) {
furi_assert(value);
@@ -531,7 +531,7 @@ static NotificationApp* notification_app_alloc() {
notification_message(app, &sequence_display_backlight_on);
return app;
};
}
// App
int32_t notification_srv(void* p) {
@@ -8,13 +8,13 @@ void notification_message(NotificationApp* app, const NotificationSequence* sequ
NotificationAppMessage m = {
.type = NotificationLayerMessage, .sequence = sequence, .back_event = NULL};
furi_check(furi_message_queue_put(app->queue, &m, FuriWaitForever) == FuriStatusOk);
};
}
void notification_internal_message(NotificationApp* app, const NotificationSequence* sequence) {
NotificationAppMessage m = {
.type = InternalLayerMessage, .sequence = sequence, .back_event = NULL};
furi_check(furi_message_queue_put(app->queue, &m, FuriWaitForever) == FuriStatusOk);
};
}
void notification_message_block(NotificationApp* app, const NotificationSequence* sequence) {
NotificationAppMessage m = {
@@ -25,7 +25,7 @@ void notification_message_block(NotificationApp* app, const NotificationSequence
furi_event_flag_wait(
m.back_event, NOTIFICATION_EVENT_COMPLETE, FuriFlagWaitAny, FuriWaitForever);
furi_event_flag_free(m.back_event);
};
}
void notification_internal_message_block(
NotificationApp* app,
@@ -36,4 +36,4 @@ void notification_internal_message_block(
furi_event_flag_wait(
m.back_event, NOTIFICATION_EVENT_COMPLETE, FuriFlagWaitAny, FuriWaitForever);
furi_event_flag_free(m.back_event);
};
}
@@ -103,7 +103,7 @@ void rgb_backlight_load_settings(void) {
storage_file_free(file);
furi_record_close(RECORD_STORAGE);
rgb_settings.settings_is_loaded = true;
};
}
void rgb_backlight_save_settings(void) {
RGBBacklightSettings settings;
@@ -134,7 +134,7 @@ void rgb_backlight_save_settings(void) {
storage_file_close(file);
storage_file_free(file);
furi_record_close(RECORD_STORAGE);
};
}
RGBBacklightSettings* rgb_backlight_get_settings(void) {
if(!rgb_settings.settings_is_loaded) {
+3 -3
View File
@@ -33,7 +33,7 @@ static void storage_cli_print_usage() {
printf("\tmd5\t - md5 hash of the file\r\n");
printf("\tstat\t - info about file or dir\r\n");
printf("\ttimestamp\t - last modification timestamp\r\n");
};
}
static void storage_cli_print_error(FS_Error error) {
printf("Storage error: %s\r\n", storage_error_get_desc(error));
@@ -86,7 +86,7 @@ static void storage_cli_info(Cli* cli, FuriString* path) {
}
furi_record_close(RECORD_STORAGE);
};
}
static void storage_cli_format(Cli* cli, FuriString* path) {
if(furi_string_cmp_str(path, STORAGE_INT_PATH_PREFIX) == 0) {
@@ -112,7 +112,7 @@ static void storage_cli_format(Cli* cli, FuriString* path) {
} else {
storage_cli_print_usage();
}
};
}
static void storage_cli_list(Cli* cli, FuriString* path) {
UNUSED(cli);
@@ -160,7 +160,7 @@ static LFSData* storage_int_lfs_data_alloc() {
lfs_data->config.lookahead_size = 16;
return lfs_data;
};
}
// Returns true if fingerprint was invalid and LFS reformatting is needed
static bool storage_int_check_and_set_fingerprint(LFSData* lfs_data) {
+2 -2
View File
@@ -179,7 +179,7 @@ static void draw_stat(Canvas* canvas, int x, int y, const Icon* icon, char* val)
canvas_draw_box(canvas, x - 4, y + 16, 24, 6);
canvas_set_color(canvas, ColorBlack);
canvas_draw_str_aligned(canvas, x + 8, y + 22, AlignCenter, AlignBottom, val);
};
}
static void draw_battery(Canvas* canvas, PowerInfo* info, int x, int y) {
char header[20] = {};
@@ -245,7 +245,7 @@ static void draw_battery(Canvas* canvas, PowerInfo* info, int x, int y) {
canvas_draw_str_aligned(canvas, x + 92, y + 9, AlignCenter, AlignCenter, header);
canvas_draw_str_aligned(canvas, x + 92, y + 19, AlignCenter, AlignCenter, value);
}
};
}
static void battery_info_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);
@@ -18,7 +18,7 @@ static void draw_stat(Canvas* canvas, int x, int y, const Icon* icon, char* val)
canvas_draw_box(canvas, x - 4, y + 16, 24, 6);
canvas_set_color(canvas, ColorBlack);
canvas_draw_str_aligned(canvas, x + 8, y + 22, AlignCenter, AlignBottom, val);
};
}
static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
char emote[20] = {};
@@ -87,7 +87,7 @@ static void draw_battery(Canvas* canvas, BatteryInfoModel* data, int x, int y) {
canvas_draw_str_aligned(canvas, 92, y + 3, AlignCenter, AlignCenter, emote);
canvas_draw_str_aligned(canvas, 92, y + 15, AlignCenter, AlignCenter, header);
canvas_draw_str_aligned(canvas, 92, y + 27, AlignCenter, AlignCenter, value);
};
}
static void battery_info_draw_callback(Canvas* canvas, void* context) {
furi_assert(context);