mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-13 13:09:49 +04:00
Write full name of preset on Read/ReadRAW screen
This commit is contained in:
@@ -33,7 +33,16 @@ static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
frequency_str = furi_string_alloc();
|
||||
modulation_str = furi_string_alloc();
|
||||
|
||||
#ifdef SUBGHZ_EXT_PRESET_NAME
|
||||
if(subghz_history_get_last_index(subghz->txrx->history)> 0) {
|
||||
subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
|
||||
} else {
|
||||
subghz_get_frequency_modulation(subghz, frequency_str, NULL);
|
||||
furi_string_printf(modulation_str, "%s", furi_string_get_cstr(subghz->txrx->preset->name));
|
||||
}
|
||||
#else
|
||||
subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
|
||||
#endif
|
||||
|
||||
subghz_view_receiver_add_data_statusbar(
|
||||
subghz->subghz_receiver,
|
||||
|
||||
@@ -46,7 +46,16 @@ static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
frequency_str = furi_string_alloc();
|
||||
modulation_str = furi_string_alloc();
|
||||
|
||||
#ifdef SUBGHZ_EXT_PRESET_NAME
|
||||
if(subghz_history_get_last_index(subghz->txrx->history)> 0) {
|
||||
subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
|
||||
} else {
|
||||
subghz_get_frequency_modulation(subghz, frequency_str, NULL);
|
||||
furi_string_printf(modulation_str, "%s", furi_string_get_cstr(subghz->txrx->preset->name));
|
||||
}
|
||||
#else
|
||||
subghz_get_frequency_modulation(subghz, frequency_str, modulation_str);
|
||||
#endif
|
||||
|
||||
subghz_view_receiver_add_data_statusbar(
|
||||
subghz->subghz_receiver,
|
||||
|
||||
@@ -309,6 +309,10 @@ bool subghz_history_get_text_space_left(SubGhzHistory* instance, FuriString* out
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t subghz_history_get_last_index(SubGhzHistory* instance) {
|
||||
return instance->last_index_write;
|
||||
}
|
||||
|
||||
void subghz_history_get_text_item_menu(SubGhzHistory* instance, FuriString* output, uint16_t idx) {
|
||||
SubGhzHistoryItem* item = SubGhzHistoryItemArray_get(instance->history->data, idx);
|
||||
furi_string_set(output, item->item_str);
|
||||
|
||||
@@ -84,6 +84,13 @@ void subghz_history_get_text_item_menu(SubGhzHistory* instance, FuriString* outp
|
||||
*/
|
||||
bool subghz_history_get_text_space_left(SubGhzHistory* instance, FuriString* output);
|
||||
|
||||
/** Return last index
|
||||
*
|
||||
* @param instance - SubGhzHistory instance
|
||||
* @return
|
||||
*/
|
||||
uint16_t subghz_history_get_last_index(SubGhzHistory* instance);
|
||||
|
||||
/** Add protocol to history
|
||||
*
|
||||
* @param instance - SubGhzHistory instance
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "rpc/rpc_app.h"
|
||||
|
||||
#define SUBGHZ_MAX_LEN_NAME 64
|
||||
#define SUBGHZ_EXT_PRESET_NAME true
|
||||
|
||||
typedef struct {
|
||||
uint8_t fix[4];
|
||||
|
||||
@@ -267,7 +267,23 @@ void subghz_view_receiver_draw(Canvas* canvas, SubGhzViewReceiverModel* model) {
|
||||
break;
|
||||
default:
|
||||
canvas_draw_str(canvas, 44, 62, furi_string_get_cstr(model->frequency_str));
|
||||
#ifdef SUBGHZ_EXT_PRESET_NAME
|
||||
if(model->history_item == 0 && model->mode == SubGhzViewReceiverModeLive) {
|
||||
const char* str = furi_string_get_cstr(model->preset_str);
|
||||
const uint8_t vertical_offset = 3;
|
||||
const uint8_t horizontal_offset = 3;
|
||||
const uint8_t string_width = canvas_string_width(canvas, str);
|
||||
canvas_draw_str(
|
||||
canvas,
|
||||
canvas_width(canvas) - string_width + horizontal_offset,
|
||||
vertical_offset,
|
||||
str);
|
||||
} else {
|
||||
canvas_draw_str(canvas, 79, 62, furi_string_get_cstr(model->preset_str));
|
||||
}
|
||||
#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));
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user