mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
No SubGhz recv limit, check free ram only
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <furi.h>
|
||||
|
||||
#define SUBGHZ_HISTORY_MAX 55
|
||||
#define SUBGHZ_HISTORY_MAX 65535 // uint16_t index max, ram limit below
|
||||
#define SUBGHZ_HISTORY_FREE_HEAP 20480
|
||||
#define TAG "SubGhzHistory"
|
||||
|
||||
@@ -179,25 +179,23 @@ FlipperFormat* subghz_history_get_raw_data(SubGhzHistory* instance, uint16_t idx
|
||||
bool subghz_history_get_text_space_left(SubGhzHistory* instance, FuriString* output, uint8_t sats) {
|
||||
furi_assert(instance);
|
||||
if(memmgr_get_free_heap() < SUBGHZ_HISTORY_FREE_HEAP) {
|
||||
if(output != NULL) furi_string_printf(output, " Free heap LOW");
|
||||
if(output != NULL) furi_string_printf(output, " Memory is FULL");
|
||||
return true;
|
||||
}
|
||||
if(instance->last_index_write == SUBGHZ_HISTORY_MAX) {
|
||||
if(output != NULL) furi_string_printf(output, " Memory is FULL");
|
||||
if(output != NULL) furi_string_printf(output, " History is FULL");
|
||||
return true;
|
||||
}
|
||||
if(output != NULL) {
|
||||
if(sats == 0) {
|
||||
furi_string_printf(
|
||||
output, "%02u/%02u", instance->last_index_write, SUBGHZ_HISTORY_MAX);
|
||||
furi_string_printf(output, "%02u", instance->last_index_write);
|
||||
return false;
|
||||
} else {
|
||||
FuriHalRtcDateTime datetime;
|
||||
furi_hal_rtc_get_datetime(&datetime);
|
||||
|
||||
if(furi_hal_rtc_datetime_to_timestamp(&datetime) % 2) {
|
||||
furi_string_printf(
|
||||
output, "%02u/%02u", instance->last_index_write, SUBGHZ_HISTORY_MAX);
|
||||
furi_string_printf(output, "%02u", instance->last_index_write);
|
||||
} else {
|
||||
furi_string_printf(output, "%d sats", sats);
|
||||
}
|
||||
|
||||
@@ -394,7 +394,16 @@ void subghz_view_receiver_draw(Canvas* canvas, SubGhzViewReceiverModel* model) {
|
||||
#else
|
||||
canvas_draw_str(canvas, 79, 62, furi_string_get_cstr(model->preset_str));
|
||||
#endif
|
||||
canvas_draw_str(canvas, 96, 62, furi_string_get_cstr(model->history_stat_str));
|
||||
if(!furi_string_empty(model->history_stat_str)) {
|
||||
canvas_draw_str_aligned(
|
||||
canvas,
|
||||
114,
|
||||
62,
|
||||
AlignRight,
|
||||
AlignBottom,
|
||||
furi_string_get_cstr(model->history_stat_str));
|
||||
canvas_draw_icon(canvas, 116, 53, &I_sub1_10px);
|
||||
}
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
elements_bold_rounded_frame(canvas, 14, 8, 99, 48);
|
||||
elements_multiline_text(canvas, 65, 26, "To unlock\npress:");
|
||||
@@ -430,7 +439,16 @@ void subghz_view_receiver_draw(Canvas* canvas, SubGhzViewReceiverModel* model) {
|
||||
#else
|
||||
canvas_draw_str(canvas, 79, 62, furi_string_get_cstr(model->preset_str));
|
||||
#endif
|
||||
canvas_draw_str(canvas, 96, 62, furi_string_get_cstr(model->history_stat_str));
|
||||
if(!furi_string_empty(model->history_stat_str)) {
|
||||
canvas_draw_str_aligned(
|
||||
canvas,
|
||||
114,
|
||||
62,
|
||||
AlignRight,
|
||||
AlignBottom,
|
||||
furi_string_get_cstr(model->history_stat_str));
|
||||
canvas_draw_icon(canvas, 116, 53, &I_sub1_10px);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user