mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Sub-GHz: Show satellites count with an icon (#215)
* feat(subghz): show satellites if enabled Replaces the display of the number of satellites during SubGHz scanning. If GPS is enabled (an an external module connected) it will blink a GPS icon with the number of sats currently in range (even if zero). Using a 10x10px "positioning" icon that replaces the SubGHz icon on the bottom right. * Revert api version to ofw release * f18 too * Tweak icon a little * Update changelog * Format --------- Co-authored-by: Willy-JL <49810075+Willy-JL@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
- NFC: Cyborg Detector (by @RocketGod-git)
|
||||
- Sub-GHz: Radio Scanner (by @RocketGod-git)
|
||||
- Sub-GHz:
|
||||
- Show satellites count with an icon (#215 by @m7i-org)
|
||||
- Add Bresser 3CH weather station protocol (#217 by @m7i-org)
|
||||
- UL: Add Marantec24 protocol (static 24 bit) with add manually (by @xMasterX)
|
||||
- UL: Add GangQi protocol (static 34 bit) with button parsing and add manually (by @xMasterX & @Skorpionm)
|
||||
|
||||
@@ -7,11 +7,13 @@
|
||||
static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
SubGhz* subghz = context;
|
||||
FuriString* history_stat_str = furi_string_alloc();
|
||||
bool show_sats = subghz->gps && furi_hal_rtc_get_timestamp() % 2;
|
||||
if(!subghz_history_get_text_space_left(
|
||||
subghz->history,
|
||||
history_stat_str,
|
||||
subghz->gps ? subghz->gps->satellites : 0,
|
||||
subghz->last_settings->delete_old_signals)) {
|
||||
subghz->last_settings->delete_old_signals,
|
||||
show_sats,
|
||||
show_sats ? subghz->gps->satellites : 0)) {
|
||||
FuriString* frequency_str = furi_string_alloc();
|
||||
FuriString* modulation_str = furi_string_alloc();
|
||||
|
||||
@@ -25,6 +27,7 @@ static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
furi_string_get_cstr(history_stat_str),
|
||||
subghz_txrx_hopper_get_state(subghz->txrx) != SubGhzHopperStateOFF,
|
||||
READ_BIT(subghz->filter, SubGhzProtocolFlag_BinRAW) > 0,
|
||||
show_sats,
|
||||
subghz->repeater);
|
||||
|
||||
furi_string_free(frequency_str);
|
||||
@@ -37,6 +40,7 @@ static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
"",
|
||||
subghz_txrx_hopper_get_state(subghz->txrx) != SubGhzHopperStateOFF,
|
||||
READ_BIT(subghz->filter, SubGhzProtocolFlag_BinRAW) > 0,
|
||||
show_sats,
|
||||
subghz->repeater);
|
||||
}
|
||||
furi_string_free(history_stat_str);
|
||||
|
||||
@@ -50,11 +50,13 @@ const NotificationSequence subghz_sequence_tx_beep = {
|
||||
static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
SubGhz* subghz = context;
|
||||
FuriString* history_stat_str = furi_string_alloc();
|
||||
bool show_sats = subghz->gps && furi_hal_rtc_get_timestamp() % 2;
|
||||
if(!subghz_history_get_text_space_left(
|
||||
subghz->history,
|
||||
history_stat_str,
|
||||
subghz->gps ? subghz->gps->satellites : 0,
|
||||
subghz->last_settings->delete_old_signals)) {
|
||||
subghz->last_settings->delete_old_signals,
|
||||
show_sats,
|
||||
show_sats ? subghz->gps->satellites : 0)) {
|
||||
FuriString* frequency_str = furi_string_alloc();
|
||||
FuriString* modulation_str = furi_string_alloc();
|
||||
|
||||
@@ -87,6 +89,7 @@ static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
furi_string_get_cstr(history_stat_str),
|
||||
subghz_txrx_hopper_get_state(subghz->txrx) != SubGhzHopperStateOFF,
|
||||
READ_BIT(subghz->filter, SubGhzProtocolFlag_BinRAW) > 0,
|
||||
show_sats,
|
||||
subghz->repeater);
|
||||
|
||||
furi_string_free(frequency_str);
|
||||
@@ -99,6 +102,7 @@ static void subghz_scene_receiver_update_statusbar(void* context) {
|
||||
"",
|
||||
subghz_txrx_hopper_get_state(subghz->txrx) != SubGhzHopperStateOFF,
|
||||
READ_BIT(subghz->filter, SubGhzProtocolFlag_BinRAW) > 0,
|
||||
show_sats,
|
||||
subghz->repeater);
|
||||
}
|
||||
furi_string_free(history_stat_str);
|
||||
|
||||
@@ -193,8 +193,9 @@ 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,
|
||||
bool ignore_full) {
|
||||
bool ignore_full,
|
||||
bool show_sats,
|
||||
uint8_t sats) {
|
||||
furi_assert(instance);
|
||||
if(!ignore_full) {
|
||||
if(memmgr_get_free_heap() < SUBGHZ_HISTORY_FREE_HEAP) {
|
||||
@@ -207,14 +208,10 @@ bool subghz_history_get_text_space_left(
|
||||
}
|
||||
}
|
||||
if(output != NULL) {
|
||||
if(sats == 0) {
|
||||
furi_string_printf(output, "%02u", instance->last_index_write);
|
||||
if(show_sats) {
|
||||
furi_string_printf(output, "%d", sats);
|
||||
} else {
|
||||
if(furi_hal_rtc_get_timestamp() % 2) {
|
||||
furi_string_printf(output, "%02u", instance->last_index_write);
|
||||
} else {
|
||||
furi_string_printf(output, "%d sats", sats);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -118,19 +118,21 @@ void subghz_history_get_text_item_menu(SubGhzHistory* instance, FuriString* outp
|
||||
*/
|
||||
void subghz_history_get_time_item_menu(SubGhzHistory* instance, FuriString* output, uint16_t idx);
|
||||
|
||||
/** Get string the remaining number of records to history
|
||||
/** Get string the remaining number of records to history, or sats
|
||||
*
|
||||
* @param instance - SubGhzHistory instance
|
||||
* @param output - FuriString* output
|
||||
* @param sats - Number of satellites
|
||||
* @param ignore_full - Ignore if history is full
|
||||
* @param show_sats - Whether to show the satellite number
|
||||
* @param sats - Number of satellites
|
||||
* @return bool - is FULL
|
||||
*/
|
||||
bool subghz_history_get_text_space_left(
|
||||
SubGhzHistory* instance,
|
||||
FuriString* output,
|
||||
uint8_t sats,
|
||||
bool ignore_full);
|
||||
bool ignore_full,
|
||||
bool show_sats,
|
||||
uint8_t sats);
|
||||
|
||||
/** Return last index
|
||||
*
|
||||
|
||||
@@ -66,6 +66,7 @@ typedef struct {
|
||||
FuriString* progress_str;
|
||||
bool hopping_enabled;
|
||||
bool bin_raw_enabled;
|
||||
bool show_sats;
|
||||
SubGhzRepeaterState repeater_state;
|
||||
SubGhzReceiverHistory* history;
|
||||
uint16_t idx;
|
||||
@@ -210,6 +211,7 @@ void subghz_view_receiver_add_data_statusbar(
|
||||
const char* history_stat_str,
|
||||
bool hopping_enabled,
|
||||
bool bin_raw_enabled,
|
||||
bool show_sats,
|
||||
SubGhzRepeaterState repeater_state) {
|
||||
furi_assert(subghz_receiver);
|
||||
with_view_model(
|
||||
@@ -221,6 +223,7 @@ void subghz_view_receiver_add_data_statusbar(
|
||||
furi_string_set(model->history_stat_str, history_stat_str);
|
||||
model->hopping_enabled = hopping_enabled;
|
||||
model->bin_raw_enabled = bin_raw_enabled;
|
||||
model->show_sats = show_sats;
|
||||
model->repeater_state = repeater_state;
|
||||
},
|
||||
true);
|
||||
@@ -408,8 +411,12 @@ void subghz_view_receiver_draw(Canvas* canvas, SubGhzViewReceiverModel* model) {
|
||||
AlignRight,
|
||||
AlignBottom,
|
||||
furi_string_get_cstr(model->history_stat_str));
|
||||
if(model->show_sats) {
|
||||
canvas_draw_icon(canvas, 118, 54, &I_Sats_6x9);
|
||||
} else {
|
||||
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:");
|
||||
@@ -453,8 +460,12 @@ void subghz_view_receiver_draw(Canvas* canvas, SubGhzViewReceiverModel* model) {
|
||||
AlignRight,
|
||||
AlignBottom,
|
||||
furi_string_get_cstr(model->history_stat_str));
|
||||
if(model->show_sats) {
|
||||
canvas_draw_icon(canvas, 118, 54, &I_Sats_6x9);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 116, 53, &I_sub1_10px);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ void subghz_view_receiver_add_data_statusbar(
|
||||
const char* history_stat_str,
|
||||
bool hopping_enabled,
|
||||
bool bin_raw_enabled,
|
||||
bool show_sats,
|
||||
SubGhzRepeaterState repeater_enabled);
|
||||
|
||||
void subghz_view_receiver_set_radio_device_type(
|
||||
|
||||
BIN
assets/icons/SubGhz/Sats_6x9.png
Normal file
BIN
assets/icons/SubGhz/Sats_6x9.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 83 B |
@@ -3987,6 +3987,7 @@ Variable,+,I_Rpc_active_7x8,const Icon,
|
||||
Variable,+,I_SDQuestion_35x43,const Icon,
|
||||
Variable,+,I_SDcardFail_11x8,const Icon,
|
||||
Variable,+,I_SDcardMounted_11x8,const Icon,
|
||||
Variable,+,I_Sats_6x9,const Icon,
|
||||
Variable,+,I_Scanning_123x52,const Icon,
|
||||
Variable,+,I_SmallArrowDown_3x5,const Icon,
|
||||
Variable,+,I_SmallArrowUp_3x5,const Icon,
|
||||
|
||||
|
Reference in New Issue
Block a user