mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-14 00:37:21 +00:00
Cnt value edit [in progress]
This commit is contained in:
parent
f93aab9b22
commit
32fb94f5db
8 changed files with 50 additions and 14 deletions
|
@ -105,7 +105,6 @@ typedef enum {
|
|||
SubGhzCustomEventViewTransmitterBack,
|
||||
SubGhzCustomEventViewTransmitterSendStart,
|
||||
SubGhzCustomEventViewTransmitterSendStop,
|
||||
SubGhzCustomEventViewTransmitterEditCnt,
|
||||
SubGhzCustomEventViewTransmitterError,
|
||||
|
||||
SubGhzCustomEventViewFreqAnalOkShort,
|
||||
|
|
|
@ -229,7 +229,7 @@ bool subghz_txrx_gen_faac_slh_protocol(
|
|||
}
|
||||
|
||||
flipper_format_write_hex(txrx->fff_data, "Seed", seed_data, sizeof(uint32_t));
|
||||
flipper_format_write_string_cstr(txrx->fff_data, "Valid", "1\n");
|
||||
flipper_format_write_string_cstr(txrx->fff_data, "Valid", "1\r\n");
|
||||
FURI_LOG_I(TAG, "Flag write to SD is OK");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "../subghz_i.h"
|
||||
#include <lib/subghz/protocols/keeloq.h>
|
||||
|
||||
#define TAG "SubGhzEditCnt"
|
||||
#define TAG "subghz_scene_edit_cnt"
|
||||
|
||||
void subghz_scene_edit_cnt_byte_input_callback(void* context) {
|
||||
SubGhz* subghz = context;
|
||||
|
@ -29,14 +28,9 @@ void subghz_scene_edit_cnt_on_enter(void* context) {
|
|||
bool subghz_scene_edit_cnt_on_event(void* context, SceneManagerEvent event) {
|
||||
SubGhz* subghz = context;
|
||||
bool consumed = false;
|
||||
uint32_t cnt;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubGhzCustomEventByteInputDone) {
|
||||
cnt = 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);
|
||||
// TO DO
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneTransmitter);
|
||||
consumed = true;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ enum SubmenuIndex {
|
|||
SubmenuIndexEmulate,
|
||||
SubmenuIndexEdit,
|
||||
SubmenuIndexDelete,
|
||||
SubmenuIndexEditCnt,
|
||||
};
|
||||
|
||||
void subghz_scene_saved_menu_submenu_callback(void* context, uint32_t index) {
|
||||
|
@ -19,6 +20,13 @@ void subghz_scene_saved_menu_on_enter(void* context) {
|
|||
SubmenuIndexEmulate,
|
||||
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,
|
||||
|
@ -60,6 +68,11 @@ 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;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#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;
|
||||
|
@ -20,6 +22,16 @@ 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) {
|
||||
subghz_protocol_decoder_base_get_string(decoder, key_str);
|
||||
|
@ -85,10 +97,6 @@ bool subghz_scene_transmitter_on_event(void* context, SceneManagerEvent event) {
|
|||
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
|
||||
}
|
||||
return true;
|
||||
} else if(event.event == SubGhzCustomEventViewTransmitterEditCnt) {
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneEditCnt);
|
||||
return true;
|
||||
} else if(event.event == SubGhzCustomEventViewTransmitterBack) {
|
||||
subghz->state_notifications = SubGhzNotificationStateIDLE;
|
||||
scene_manager_search_and_switch_to_previous_scene(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
entry,status,name,type,params
|
||||
Version,+,35.1,,
|
||||
Version,+,35.2,,
|
||||
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/cli/cli.h,,
|
||||
|
@ -1419,6 +1419,7 @@ 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_rssi,float,
|
||||
Function,+,furi_hal_subghz_idle,void,
|
||||
Function,-,furi_hal_subghz_init,void,
|
||||
|
@ -1439,6 +1440,7 @@ 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_shutdown,void,
|
||||
Function,+,furi_hal_subghz_sleep,void,
|
||||
Function,+,furi_hal_subghz_start_async_rx,void,"FuriHalSubGhzCaptureCallback, void*"
|
||||
|
|
|
|
@ -53,6 +53,7 @@ typedef struct {
|
|||
const GpioPin* async_mirror_pin;
|
||||
|
||||
uint8_t rolling_counter_mult;
|
||||
uint32_t rolling_counter_value;
|
||||
bool ext_power_amp : 1;
|
||||
bool dangerous_frequency_i : 1;
|
||||
} FuriHalSubGhz;
|
||||
|
@ -62,6 +63,7 @@ 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,
|
||||
};
|
||||
|
@ -74,6 +76,14 @@ void furi_hal_subghz_set_rolling_counter_mult(uint8_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;
|
||||
}
|
||||
|
|
|
@ -183,6 +183,16 @@ uint8_t furi_hal_subghz_get_rolling_counter_mult(void);
|
|||
*/
|
||||
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);
|
||||
|
||||
/** Set frequency
|
||||
*
|
||||
* @param value frequency in Hz
|
||||
|
|
Loading…
Reference in a new issue