Merge branch 'dev' into somfy_keytis

This commit is contained in:
MX 2023-01-19 20:02:18 +03:00
commit e07b96e04b
No known key found for this signature in database
GPG key ID: 6C4C311DFD4B4AB5
6 changed files with 48 additions and 69 deletions

View file

@ -173,7 +173,6 @@ bool subghz_scene_receiver_on_event(void* context, SceneManagerEvent event) {
subghz_sleep(subghz);
}
subghz->txrx->hopper_state = SubGhzHopperStateOFF;
subghz_history_set_hopper_state(subghz->txrx->history, false);
subghz->txrx->idx_menu_chosen = 0;
subghz_receiver_set_rx_callback(subghz->txrx->receiver, NULL, subghz);

View file

@ -231,64 +231,64 @@ static void subghz_scene_receiver_config_set_detect_raw(VariableItem* item) {
SubGhz* subghz = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
//if(subghz->txrx->hopper_state == 0) {
variable_item_set_current_value_text(item, detect_raw_text[index]);
if(subghz->txrx->hopper_state == 0) {
variable_item_set_current_value_text(item, detect_raw_text[index]);
#ifdef SUBGHZ_SAVE_DETECT_RAW_SETTING
subghz->last_settings->detect_raw = index;
subghz->last_settings->detect_raw = index;
subghz_last_settings_set_detect_raw_values(subghz);
subghz_last_settings_set_detect_raw_values(subghz);
#else
subghz_receiver_set_filter(subghz->txrx->receiver, detect_raw_value[index]);
subghz_receiver_set_filter(subghz->txrx->receiver, detect_raw_value[index]);
subghz_protocol_decoder_raw_set_auto_mode(
subghz_receiver_search_decoder_base_by_name(
subghz->txrx->receiver, SUBGHZ_PROTOCOL_RAW_NAME),
(index == 1));
subghz_protocol_decoder_raw_set_auto_mode(
subghz_receiver_search_decoder_base_by_name(
subghz->txrx->receiver, SUBGHZ_PROTOCOL_RAW_NAME),
(index == 1));
#endif
/*} else {
} else {
variable_item_set_current_value_index(item, 0);
}*/
}
}
static void subghz_scene_receiver_config_set_hopping_running(VariableItem* item) {
SubGhz* subghz = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item);
//if(subghz_receiver_get_filter(subghz->txrx->receiver) == SubGhzProtocolFlag_Decodable) {
variable_item_set_current_value_text(item, hopping_text[index]);
if(hopping_value[index] == SubGhzHopperStateOFF) {
char text_buf[10] = {0};
snprintf(
text_buf,
sizeof(text_buf),
"%lu.%02lu",
subghz_setting_get_default_frequency(subghz->setting) / 1000000,
(subghz_setting_get_default_frequency(subghz->setting) % 1000000) / 10000);
variable_item_set_current_value_text(
(VariableItem*)scene_manager_get_scene_state(
subghz->scene_manager, SubGhzSceneReceiverConfig),
text_buf);
subghz->txrx->preset->frequency = subghz_setting_get_default_frequency(subghz->setting);
variable_item_set_current_value_index(
(VariableItem*)scene_manager_get_scene_state(
subghz->scene_manager, SubGhzSceneReceiverConfig),
subghz_setting_get_frequency_default_index(subghz->setting));
} else {
variable_item_set_current_value_text(
(VariableItem*)scene_manager_get_scene_state(
subghz->scene_manager, SubGhzSceneReceiverConfig),
" -----");
variable_item_set_current_value_index(
(VariableItem*)scene_manager_get_scene_state(
subghz->scene_manager, SubGhzSceneReceiverConfig),
subghz_setting_get_frequency_default_index(subghz->setting));
}
if(subghz_receiver_get_filter(subghz->txrx->receiver) == SubGhzProtocolFlag_Decodable) {
variable_item_set_current_value_text(item, hopping_text[index]);
if(hopping_value[index] == SubGhzHopperStateOFF) {
char text_buf[10] = {0};
snprintf(
text_buf,
sizeof(text_buf),
"%lu.%02lu",
subghz_setting_get_default_frequency(subghz->setting) / 1000000,
(subghz_setting_get_default_frequency(subghz->setting) % 1000000) / 10000);
variable_item_set_current_value_text(
(VariableItem*)scene_manager_get_scene_state(
subghz->scene_manager, SubGhzSceneReceiverConfig),
text_buf);
subghz->txrx->preset->frequency =
subghz_setting_get_default_frequency(subghz->setting);
variable_item_set_current_value_index(
(VariableItem*)scene_manager_get_scene_state(
subghz->scene_manager, SubGhzSceneReceiverConfig),
subghz_setting_get_frequency_default_index(subghz->setting));
} else {
variable_item_set_current_value_text(
(VariableItem*)scene_manager_get_scene_state(
subghz->scene_manager, SubGhzSceneReceiverConfig),
" -----");
variable_item_set_current_value_index(
(VariableItem*)scene_manager_get_scene_state(
subghz->scene_manager, SubGhzSceneReceiverConfig),
subghz_setting_get_frequency_default_index(subghz->setting));
}
subghz->txrx->hopper_state = hopping_value[index];
subghz_history_set_hopper_state(subghz->txrx->history, (index == 1));
/*} else {
subghz->txrx->hopper_state = hopping_value[index];
} else {
variable_item_set_current_value_index(item, 0);
}*/
}
}
static void subghz_scene_receiver_config_set_speaker(VariableItem* item) {

View file

@ -46,7 +46,6 @@ struct SubGhzHistory {
uint8_t code_last_hash_data;
FuriString* tmp_string;
bool write_tmp_files;
bool is_hopper_running;
Storage* storage;
SubGhzHistoryStruct* history;
};
@ -140,8 +139,6 @@ SubGhzHistory* subghz_history_alloc(void) {
instance->storage = furi_record_open(RECORD_STORAGE);
instance->write_tmp_files = subghz_history_check_sdcard(instance);
instance->is_hopper_running = false;
if(!instance->write_tmp_files) {
FURI_LOG_E(TAG, "Unstable work! Cannot use SD Card!");
}
@ -217,12 +214,6 @@ void subghz_history_reset(SubGhzHistory* instance) {
instance->code_last_hash_data = 0;
}
void subghz_history_set_hopper_state(SubGhzHistory* instance, bool hopper_state) {
furi_assert(instance);
instance->is_hopper_running = hopper_state;
}
uint16_t subghz_history_get_item(SubGhzHistory* instance) {
furi_assert(instance);
return instance->last_index_write;
@ -372,10 +363,6 @@ bool subghz_history_add_to_history(
item->protocol_name, "%s", furi_string_get_cstr(instance->tmp_string));
}
if(!strcmp(furi_string_get_cstr(instance->tmp_string), "RAW")) {
// Check if hopper enabled we need to add little delay
if(instance->is_hopper_running) {
furi_delay_ms(40);
}
// Enable writing temp files to micro sd
tmp_file_for_raw = true;
// Write display name

View file

@ -110,10 +110,3 @@ bool subghz_history_add_to_history(
* @return SubGhzProtocolCommonLoad*
*/
FlipperFormat* subghz_history_get_raw_data(SubGhzHistory* instance, uint16_t idx);
/** Set hopper state for internal usage in history
*
* @param instance - SubGhzHistory instance
* @param hopper_state - bool is hopper running?
*/
void subghz_history_set_hopper_state(SubGhzHistory* instance, bool hopper_state);

View file

@ -88,10 +88,10 @@ Your frequencies will be added after default ones
### Default hopper list
```
310000000,
315000000,
318000000,
330000000,
390000000,
433420000,
433920000,
868350000,
```

View file

@ -76,10 +76,10 @@ static const uint32_t subghz_frequency_list[] = {
};
static const uint32_t subghz_hopper_frequency_list[] = {
310000000,
315000000,
318000000,
330000000,
390000000,
433420000,
433920000,
868350000,
0,