mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-26 22:40:25 +00:00
Good Monday
[SubGhz / RadioSettings] More flexible rolling counter rate; Remove unused stuff & small UI revisal
This commit is contained in:
parent
ce1336c0ed
commit
a772408ee6
9 changed files with 33 additions and 110 deletions
|
@ -23,5 +23,4 @@ ADD_SCENE(subghz, more_raw, MoreRAW)
|
|||
ADD_SCENE(subghz, decode_raw, DecodeRAW)
|
||||
ADD_SCENE(subghz, delete_raw, DeleteRAW)
|
||||
ADD_SCENE(subghz, need_saving, NeedSaving)
|
||||
ADD_SCENE(subghz, rpc, Rpc)
|
||||
ADD_SCENE(subghz, edit_cnt, EditCnt)
|
||||
ADD_SCENE(subghz, rpc, Rpc)
|
|
@ -1,48 +0,0 @@
|
|||
#include "../subghz_i.h"
|
||||
|
||||
#define TAG "subghz_scene_edit_cnt"
|
||||
|
||||
void subghz_scene_edit_cnt_byte_input_callback(void* context) {
|
||||
SubGhz* subghz = context;
|
||||
|
||||
view_dispatcher_send_custom_event(subghz->view_dispatcher, SubGhzCustomEventByteInputDone);
|
||||
}
|
||||
|
||||
void subghz_scene_edit_cnt_on_enter(void* context) {
|
||||
SubGhz* subghz = context;
|
||||
|
||||
// Setup view
|
||||
ByteInput* byte_input = subghz->byte_input;
|
||||
|
||||
byte_input_set_header_text(byte_input, "Enter COUNTER in hex");
|
||||
byte_input_set_result_callback(
|
||||
byte_input,
|
||||
subghz_scene_edit_cnt_byte_input_callback,
|
||||
NULL,
|
||||
subghz,
|
||||
subghz->secure_data->cnt,
|
||||
4);
|
||||
view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdByteInput);
|
||||
}
|
||||
|
||||
bool subghz_scene_edit_cnt_on_event(void* context, SceneManagerEvent event) {
|
||||
SubGhz* subghz = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubGhzCustomEventByteInputDone) {
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneTransmitter);
|
||||
consumed = true;
|
||||
}
|
||||
memset(subghz->secure_data->cnt, 0, sizeof(subghz->secure_data->cnt));
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void subghz_scene_edit_cnt_on_exit(void* context) {
|
||||
SubGhz* subghz = context;
|
||||
|
||||
// Clear view
|
||||
byte_input_set_result_callback(subghz->byte_input, NULL, NULL, NULL, NULL, 0);
|
||||
byte_input_set_header_text(subghz->byte_input, "");
|
||||
}
|
|
@ -32,7 +32,7 @@ const char* const debug_pin_text[DEBUG_P_COUNT] = {
|
|||
"17(1W)",
|
||||
};
|
||||
|
||||
#define DEBUG_COUNTER_COUNT 6
|
||||
#define DEBUG_COUNTER_COUNT 15
|
||||
const char* const debug_counter_text[DEBUG_COUNTER_COUNT] = {
|
||||
"+1",
|
||||
"+2",
|
||||
|
@ -40,6 +40,15 @@ const char* const debug_counter_text[DEBUG_COUNTER_COUNT] = {
|
|||
"+4",
|
||||
"+5",
|
||||
"+10",
|
||||
"+100",
|
||||
"0",
|
||||
"-1",
|
||||
"-2",
|
||||
"-3",
|
||||
"-4",
|
||||
"-5",
|
||||
"-10",
|
||||
"-100",
|
||||
};
|
||||
const uint32_t debug_counter_val[DEBUG_COUNTER_COUNT] = {
|
||||
1,
|
||||
|
@ -48,6 +57,15 @@ const uint32_t debug_counter_val[DEBUG_COUNTER_COUNT] = {
|
|||
4,
|
||||
5,
|
||||
10,
|
||||
100,
|
||||
0,
|
||||
-1,
|
||||
-2,
|
||||
-3,
|
||||
-4,
|
||||
-5,
|
||||
-10,
|
||||
-100,
|
||||
};
|
||||
|
||||
static void subghz_scene_radio_settings_set_device(VariableItem* item) {
|
||||
|
|
|
@ -4,7 +4,6 @@ enum SubmenuIndex {
|
|||
SubmenuIndexEmulate,
|
||||
SubmenuIndexEdit,
|
||||
SubmenuIndexDelete,
|
||||
SubmenuIndexEditCnt,
|
||||
};
|
||||
|
||||
void subghz_scene_saved_menu_submenu_callback(void* context, uint32_t index) {
|
||||
|
@ -21,13 +20,6 @@ void subghz_scene_saved_menu_on_enter(void* context) {
|
|||
subghz_scene_saved_menu_submenu_callback,
|
||||
subghz);
|
||||
|
||||
submenu_add_item(
|
||||
subghz->submenu,
|
||||
"Edit counter",
|
||||
SubmenuIndexEditCnt,
|
||||
subghz_scene_saved_menu_submenu_callback,
|
||||
subghz);
|
||||
|
||||
submenu_add_item(
|
||||
subghz->submenu,
|
||||
"Rename",
|
||||
|
@ -68,11 +60,6 @@ bool subghz_scene_saved_menu_on_event(void* context, SceneManagerEvent event) {
|
|||
subghz->scene_manager, SubGhzSceneSavedMenu, SubmenuIndexEdit);
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneSaveName);
|
||||
return true;
|
||||
} else if(event.event == SubmenuIndexEditCnt) {
|
||||
scene_manager_set_scene_state(
|
||||
subghz->scene_manager, SubGhzSceneSavedMenu, SubmenuIndexEditCnt);
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneEditCnt);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -29,7 +29,7 @@ void subghz_scene_set_cnt_on_enter(void* context) {
|
|||
break;
|
||||
case SubmenuIndexFaacSLH_433:
|
||||
case SubmenuIndexFaacSLH_868:
|
||||
byte_input_set_header_text(byte_input, "Enter COUNTER in hex");
|
||||
byte_input_set_header_text(byte_input, "Enter COUNTER in hex [20 bits]");
|
||||
byte_input_set_result_callback(
|
||||
byte_input,
|
||||
subghz_scene_set_cnt_byte_input_callback,
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
#include <lib/subghz/blocks/custom_btn.h>
|
||||
|
||||
#define TAG "subghz_scene_transmitter"
|
||||
|
||||
void subghz_scene_transmitter_callback(SubGhzCustomEvent event, void* context) {
|
||||
furi_assert(context);
|
||||
SubGhz* subghz = context;
|
||||
|
@ -22,15 +20,6 @@ bool subghz_scene_transmitter_update_data_show(void* context) {
|
|||
FuriString* frequency_str = furi_string_alloc();
|
||||
FuriString* modulation_str = furi_string_alloc();
|
||||
|
||||
if(scene_manager_has_previous_scene(subghz->scene_manager, SubGhzSceneEditCnt)) {
|
||||
FURI_LOG_I(TAG, "<transmitter> has previous scene <EditCnt>");
|
||||
uint32_t cnt_temp;
|
||||
cnt_temp = subghz->secure_data->cnt[0] << 24 | subghz->secure_data->cnt[1] << 16 |
|
||||
subghz->secure_data->cnt[2] << 8 | subghz->secure_data->cnt[3];
|
||||
FURI_LOG_I(TAG, "cnt = %08lX", cnt_temp);
|
||||
furi_hal_subghz_set_rolling_counter_value(cnt_temp);
|
||||
FURI_LOG_I(TAG, "furi_hal_subghz.rolling_counter_value == %08lX", cnt_temp);
|
||||
}
|
||||
|
||||
if(subghz_protocol_decoder_base_deserialize(
|
||||
decoder, subghz_txrx_get_fff_data(subghz->txrx)) == SubGhzProtocolStatusOk) {
|
||||
|
@ -89,7 +78,7 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
|
|||
subghz_txrx_stop(subghz->txrx);
|
||||
if(subghz_custom_btn_get() != SUBGHZ_CUSTOM_BTN_OK) {
|
||||
subghz_custom_btn_set(SUBGHZ_CUSTOM_BTN_OK);
|
||||
uint8_t tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
|
||||
int8_t tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
|
||||
furi_hal_subghz_set_rolling_counter_mult(0);
|
||||
// Calling restore!
|
||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||
|
|
|
@ -1418,8 +1418,7 @@ Function,+,furi_hal_subghz_flush_tx,void,
|
|||
Function,+,furi_hal_subghz_get_data_gpio,const GpioPin*,
|
||||
Function,+,furi_hal_subghz_get_ext_power_amp,_Bool,
|
||||
Function,+,furi_hal_subghz_get_lqi,uint8_t,
|
||||
Function,+,furi_hal_subghz_get_rolling_counter_mult,uint8_t,
|
||||
Function,+,furi_hal_subghz_get_rolling_counter_value,uint32_t,
|
||||
Function,+,furi_hal_subghz_get_rolling_counter_mult,int8_t,
|
||||
Function,+,furi_hal_subghz_get_rssi,float,
|
||||
Function,+,furi_hal_subghz_idle,void,
|
||||
Function,-,furi_hal_subghz_init,void,
|
||||
|
@ -1439,8 +1438,7 @@ Function,+,furi_hal_subghz_set_ext_power_amp,void,_Bool
|
|||
Function,+,furi_hal_subghz_set_frequency,uint32_t,uint32_t
|
||||
Function,+,furi_hal_subghz_set_frequency_and_path,uint32_t,uint32_t
|
||||
Function,+,furi_hal_subghz_set_path,void,FuriHalSubGhzPath
|
||||
Function,+,furi_hal_subghz_set_rolling_counter_mult,void,uint8_t
|
||||
Function,+,furi_hal_subghz_set_rolling_counter_value,void,uint32_t
|
||||
Function,+,furi_hal_subghz_set_rolling_counter_mult,void,int8_t
|
||||
Function,+,furi_hal_subghz_shutdown,void,
|
||||
Function,+,furi_hal_subghz_sleep,void,
|
||||
Function,+,furi_hal_subghz_start_async_rx,void,"FuriHalSubGhzCaptureCallback, void*"
|
||||
|
|
|
|
@ -52,8 +52,7 @@ typedef struct {
|
|||
volatile SubGhzRegulation regulation;
|
||||
const GpioPin* async_mirror_pin;
|
||||
|
||||
uint8_t rolling_counter_mult;
|
||||
uint32_t rolling_counter_value;
|
||||
int8_t rolling_counter_mult;
|
||||
bool ext_power_amp : 1;
|
||||
bool dangerous_frequency_i : 1;
|
||||
} FuriHalSubGhz;
|
||||
|
@ -63,27 +62,18 @@ volatile FuriHalSubGhz furi_hal_subghz = {
|
|||
.regulation = SubGhzRegulationTxRx,
|
||||
.async_mirror_pin = NULL,
|
||||
.rolling_counter_mult = 1,
|
||||
.rolling_counter_value = 0x0,
|
||||
.ext_power_amp = false,
|
||||
.dangerous_frequency_i = false,
|
||||
};
|
||||
|
||||
uint8_t furi_hal_subghz_get_rolling_counter_mult(void) {
|
||||
int8_t furi_hal_subghz_get_rolling_counter_mult(void) {
|
||||
return furi_hal_subghz.rolling_counter_mult;
|
||||
}
|
||||
|
||||
void furi_hal_subghz_set_rolling_counter_mult(uint8_t mult) {
|
||||
void furi_hal_subghz_set_rolling_counter_mult(int8_t mult) {
|
||||
furi_hal_subghz.rolling_counter_mult = mult;
|
||||
}
|
||||
|
||||
uint32_t furi_hal_subghz_get_rolling_counter_value(void) {
|
||||
return furi_hal_subghz.rolling_counter_value;
|
||||
}
|
||||
|
||||
void furi_hal_subghz_set_rolling_counter_value(uint32_t value) {
|
||||
furi_hal_subghz.rolling_counter_value = value;
|
||||
}
|
||||
|
||||
void furi_hal_subghz_set_dangerous_frequency(bool state_i) {
|
||||
furi_hal_subghz.dangerous_frequency_i = state_i;
|
||||
}
|
||||
|
|
|
@ -173,25 +173,15 @@ uint32_t furi_hal_subghz_set_frequency_and_path(uint32_t value);
|
|||
*/
|
||||
bool furi_hal_subghz_is_tx_allowed(uint32_t value);
|
||||
|
||||
/** Get the current rolling protocols counter ++ value
|
||||
* @return uint8_t current value
|
||||
/** Get the current rolling protocols counter ++/-- value
|
||||
* @return int8_t current value
|
||||
*/
|
||||
uint8_t furi_hal_subghz_get_rolling_counter_mult(void);
|
||||
int8_t furi_hal_subghz_get_rolling_counter_mult(void);
|
||||
|
||||
/** Set the current rolling protocols counter ++ value
|
||||
* @param mult uint8_t = 1, 2, 4, 8
|
||||
/** Set the current rolling protocols counter ++/-- value
|
||||
* @param mult int8_t = -1, -10, -100, 0, 1, 10, 100
|
||||
*/
|
||||
void furi_hal_subghz_set_rolling_counter_mult(uint8_t mult);
|
||||
|
||||
/** Get the current rolling protocols counter value
|
||||
* @return uint32_t current value
|
||||
*/
|
||||
uint32_t furi_hal_subghz_get_rolling_counter_value(void);
|
||||
|
||||
/** Set the current rolling protocols counter value
|
||||
* @param value uint32_t = 0xFFFF / 0xFFFFF / 0xFFFFFFFF
|
||||
*/
|
||||
void furi_hal_subghz_set_rolling_counter_value(uint32_t value);
|
||||
void furi_hal_subghz_set_rolling_counter_mult(int8_t mult);
|
||||
|
||||
/** Set frequency
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue