mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
Merge remote-tracking branch 'ul/dev' into mntm-dev --nobuild
This commit is contained in:
@@ -149,22 +149,22 @@ void subghz_scene_signal_settings_on_enter(void* context) {
|
|||||||
|
|
||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
FlipperFormat* fff_data_file = flipper_format_file_alloc(storage);
|
FlipperFormat* fff_data_file = flipper_format_file_alloc(storage);
|
||||||
FuriString* tmp_string = furi_string_alloc();
|
FuriString* tmp_text = furi_string_alloc_set_str("");
|
||||||
|
|
||||||
uint32_t tmp_counter_mode = 0;
|
uint32_t tmp_counter_mode = 0;
|
||||||
counter_mode = 0xff;
|
counter_mode = 0xff;
|
||||||
uint8_t mode_count = 1;
|
uint8_t mode_count = 1;
|
||||||
|
|
||||||
// Open file and check is it contains allowed protocols and CounterMode variable - if not then CcounterMode will stay 0xff
|
// Open file and check is it contains allowed protocols and CounterMode variable - if not then CounterMode will stay 0xff
|
||||||
// if file contain allowed protocol but not contain CounterMode value then setup default CounterMode value = 0 and available CounterMode count for this protocol
|
// if file contain allowed protocol but not contain CounterMode value then setup default CounterMode value = 0 and available CounterMode count for this protocol
|
||||||
// if file contain CounterMode value then load it
|
// if file contain CounterMode value then load it
|
||||||
if(!flipper_format_file_open_existing(fff_data_file, file_path)) {
|
if(!flipper_format_file_open_existing(fff_data_file, file_path)) {
|
||||||
FURI_LOG_E(TAG, "Error open file %s", file_path);
|
FURI_LOG_E(TAG, "Error open file %s", file_path);
|
||||||
} else {
|
} else {
|
||||||
flipper_format_read_string(fff_data_file, "Protocol", tmp_string);
|
flipper_format_read_string(fff_data_file, "Protocol", tmp_text);
|
||||||
// compare available protocols names, load CounterMode value from file and setup variable_item_list values_count
|
// compare available protocols names, load CounterMode value from file and setup variable_item_list values_count
|
||||||
for(uint8_t i = 0; i < PROTOCOLS_COUNT i++) {
|
for(uint8_t i = 0; i < PROTOCOLS_COUNT i++) {
|
||||||
if(!strcmp(furi_string_get_cstr(tmp_string), protocols[i].name)) {
|
if(!strcmp(furi_string_get_cstr(tmp_text), protocols[i].name)) {
|
||||||
mode_count = protocols[i].mode_count;
|
mode_count = protocols[i].mode_count;
|
||||||
if(flipper_format_read_uint32(fff_data_file, "CounterMode", &tmp_counter_mode, 1)) {
|
if(flipper_format_read_uint32(fff_data_file, "CounterMode", &tmp_counter_mode, 1)) {
|
||||||
counter_mode = (uint8_t)tmp_counter_mode;
|
counter_mode = (uint8_t)tmp_counter_mode;
|
||||||
@@ -176,40 +176,14 @@ void subghz_scene_signal_settings_on_enter(void* context) {
|
|||||||
}
|
}
|
||||||
FURI_LOG_D(TAG, "Current CounterMode value %li", counter_mode);
|
FURI_LOG_D(TAG, "Current CounterMode value %li", counter_mode);
|
||||||
|
|
||||||
furi_string_free(tmp_string);
|
|
||||||
flipper_format_file_close(fff_data_file);
|
flipper_format_file_close(fff_data_file);
|
||||||
flipper_format_free(fff_data_file);
|
flipper_format_free(fff_data_file);
|
||||||
furi_record_close(RECORD_STORAGE);
|
furi_record_close(RECORD_STORAGE);
|
||||||
|
|
||||||
//Create and Enable/Disable variable_item_list depent from current CounterMode value
|
|
||||||
VariableItemList* variable_item_list = subghz->variable_item_list;
|
|
||||||
int32_t value_index;
|
|
||||||
VariableItem* item;
|
|
||||||
|
|
||||||
variable_item_list_set_selected_item(subghz->variable_item_list, 0);
|
|
||||||
variable_item_list_reset(subghz->variable_item_list);
|
|
||||||
|
|
||||||
variable_item_list_set_enter_callback(
|
|
||||||
variable_item_list,
|
|
||||||
subghz_scene_signal_settings_variable_item_list_enter_callback,
|
|
||||||
subghz);
|
|
||||||
|
|
||||||
item = variable_item_list_add(
|
|
||||||
variable_item_list,
|
|
||||||
"Counter Mode",
|
|
||||||
mode_count,
|
|
||||||
subghz_scene_signal_settings_counter_mode_changed,
|
|
||||||
subghz);
|
|
||||||
value_index = value_index_int32(counter_mode, counter_mode_value, mode_count);
|
|
||||||
|
|
||||||
variable_item_set_current_value_index(item, value_index);
|
|
||||||
variable_item_set_current_value_text(item, counter_mode_text[value_index]);
|
|
||||||
variable_item_set_locked(item, (counter_mode == 0xff), "Not available\nfor this\nprotocol !");
|
|
||||||
|
|
||||||
// ### Counter edit section ###
|
// ### Counter edit section ###
|
||||||
FuriString* tmp_text = furi_string_alloc_set_str("");
|
|
||||||
FuriString* textCnt = furi_string_alloc_set_str("");
|
FuriString* textCnt = furi_string_alloc_set_str("");
|
||||||
byte_input_text = furi_string_alloc_set_str("Enter ");
|
byte_input_text = furi_string_alloc_set_str("Enter ");
|
||||||
|
furi_string_reset(tmp_text);
|
||||||
|
|
||||||
bool counter_not_available = true;
|
bool counter_not_available = true;
|
||||||
SubGhzProtocolDecoderBase* decoder = subghz_txrx_get_decoder(subghz->txrx);
|
SubGhzProtocolDecoderBase* decoder = subghz_txrx_get_decoder(subghz->txrx);
|
||||||
@@ -228,11 +202,20 @@ void subghz_scene_signal_settings_on_enter(void* context) {
|
|||||||
|
|
||||||
int8_t place = furi_string_search_str(tmp_text, "Cnt:??", 0);
|
int8_t place = furi_string_search_str(tmp_text, "Cnt:??", 0);
|
||||||
if(place > 0) {
|
if(place > 0) {
|
||||||
FURI_LOG_D(TAG, "Founded Cnt:???? - counter not available for this protocol");
|
counter_mode = 0xff;
|
||||||
|
FURI_LOG_D(
|
||||||
|
TAG, "Founded Cnt:???? - Counter mode and edit not available for this protocol");
|
||||||
} else {
|
} else {
|
||||||
place = furi_string_search_str(tmp_text, "Cnt:", 0);
|
place = furi_string_search_str(tmp_text, "Cnt:", 0);
|
||||||
if(place > 0) {
|
if(place > 0) {
|
||||||
furi_string_set_n(textCnt, tmp_text, place + 4, 8);
|
// defence from memory leaks. Check can we take 8 symbols after 'Cnt:' ?
|
||||||
|
// if from current place to end of stirngs more than 8 symbols - ok, if not - just take symbols from current place to end of string.
|
||||||
|
// +4 - its 'Cnt:' lenght
|
||||||
|
uint8_t n_symbols_taken = 8;
|
||||||
|
if(sizeof(tmp_text) - (place + 4) < 8) {
|
||||||
|
n_symbols_taken = sizeof(tmp_text) - (place + 4);
|
||||||
|
}
|
||||||
|
furi_string_set_n(textCnt, tmp_text, place + 4, n_symbols_taken);
|
||||||
furi_string_trim(textCnt);
|
furi_string_trim(textCnt);
|
||||||
FURI_LOG_D(
|
FURI_LOG_D(
|
||||||
TAG,
|
TAG,
|
||||||
@@ -278,13 +261,38 @@ void subghz_scene_signal_settings_on_enter(void* context) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
FURI_LOG_D(TAG, "Counter not available for this protocol");
|
FURI_LOG_D(TAG, "Counter editor not available for this protocol");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
furi_assert(byte_ptr);
|
furi_assert(byte_ptr);
|
||||||
furi_assert(byte_count > 0);
|
furi_assert(byte_count > 0);
|
||||||
|
|
||||||
|
//Create and Enable/Disable variable_item_list depent from current values
|
||||||
|
VariableItemList* variable_item_list = subghz->variable_item_list;
|
||||||
|
int32_t value_index;
|
||||||
|
VariableItem* item;
|
||||||
|
|
||||||
|
// variable_item_list_set_selected_item(subghz->variable_item_list, 0);
|
||||||
|
// variable_item_list_reset(subghz->variable_item_list);
|
||||||
|
|
||||||
|
variable_item_list_set_enter_callback(
|
||||||
|
variable_item_list,
|
||||||
|
subghz_scene_signal_settings_variable_item_list_enter_callback,
|
||||||
|
subghz);
|
||||||
|
|
||||||
|
item = variable_item_list_add(
|
||||||
|
variable_item_list,
|
||||||
|
"Counter Mode",
|
||||||
|
mode_count,
|
||||||
|
subghz_scene_signal_settings_counter_mode_changed,
|
||||||
|
subghz);
|
||||||
|
value_index = value_index_int32(counter_mode, counter_mode_value, mode_count);
|
||||||
|
|
||||||
|
variable_item_set_current_value_index(item, value_index);
|
||||||
|
variable_item_set_current_value_text(item, counter_mode_text[value_index]);
|
||||||
|
variable_item_set_locked(item, (counter_mode == 0xff), "Not available\nfor this\nprotocol !");
|
||||||
|
|
||||||
item = variable_item_list_add(variable_item_list, "Edit Counter", 1, NULL, subghz);
|
item = variable_item_list_add(variable_item_list, "Edit Counter", 1, NULL, subghz);
|
||||||
variable_item_set_current_value_index(item, 0);
|
variable_item_set_current_value_index(item, 0);
|
||||||
variable_item_set_current_value_text(item, furi_string_get_cstr(tmp_text));
|
variable_item_set_current_value_text(item, furi_string_get_cstr(tmp_text));
|
||||||
@@ -327,20 +335,19 @@ bool subghz_scene_signal_settings_on_event(void* context, SceneManagerEvent even
|
|||||||
// convert back after byte_input and do one send with our new mult (counter16) - at end we must have signal Cnt = counter16
|
// convert back after byte_input and do one send with our new mult (counter16) - at end we must have signal Cnt = counter16
|
||||||
counter16 = __bswap16(counter16);
|
counter16 = __bswap16(counter16);
|
||||||
|
|
||||||
if(counter16 > 0) {
|
|
||||||
furi_hal_subghz_set_rolling_counter_mult(counter16);
|
furi_hal_subghz_set_rolling_counter_mult(counter16);
|
||||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||||
subghz_txrx_stop(subghz->txrx);
|
subghz_txrx_stop(subghz->txrx);
|
||||||
}
|
|
||||||
|
|
||||||
// restore user definded counter increase value (mult)
|
// restore user definded counter increase value (mult)
|
||||||
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
|
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
// the same for 32 bit Counter
|
// the same for 32 bit Counter
|
||||||
tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
|
tmp_counter = furi_hal_subghz_get_rolling_counter_mult();
|
||||||
|
|
||||||
furi_hal_subghz_set_rolling_counter_mult(0xFFFFFFFF);
|
furi_hal_subghz_set_rolling_counter_mult(0xFFFFFFF);
|
||||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||||
subghz_txrx_stop(subghz->txrx);
|
subghz_txrx_stop(subghz->txrx);
|
||||||
|
|
||||||
@@ -352,11 +359,9 @@ bool subghz_scene_signal_settings_on_event(void* context, SceneManagerEvent even
|
|||||||
|
|
||||||
counter32 = __bswap32(counter32);
|
counter32 = __bswap32(counter32);
|
||||||
|
|
||||||
if(counter32 > 0) {
|
furi_hal_subghz_set_rolling_counter_mult((counter32 & 0xFFFFFFF));
|
||||||
furi_hal_subghz_set_rolling_counter_mult(counter32);
|
|
||||||
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
subghz_tx_start(subghz, subghz_txrx_get_fff_data(subghz->txrx));
|
||||||
subghz_txrx_stop(subghz->txrx);
|
subghz_txrx_stop(subghz->txrx);
|
||||||
}
|
|
||||||
|
|
||||||
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
|
furi_hal_subghz_set_rolling_counter_mult(tmp_counter);
|
||||||
break;
|
break;
|
||||||
@@ -405,6 +410,13 @@ void subghz_scene_signal_settings_on_exit(void* context) {
|
|||||||
flipper_format_file_close(fff_data_file);
|
flipper_format_file_close(fff_data_file);
|
||||||
flipper_format_free(fff_data_file);
|
flipper_format_free(fff_data_file);
|
||||||
furi_record_close(RECORD_STORAGE);
|
furi_record_close(RECORD_STORAGE);
|
||||||
|
|
||||||
|
// we need reload file after editing when we exit from Signal Settings menu.
|
||||||
|
if(subghz_key_load(subghz, file_path, false)) {
|
||||||
|
FURI_LOG_D(TAG, "Subghz file was successfully reloaded");
|
||||||
|
} else {
|
||||||
|
FURI_LOG_E(TAG, "Error reloading subghz file");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear views
|
// Clear views
|
||||||
|
|||||||
@@ -280,17 +280,11 @@ static bool subghz_protocol_alutech_at_4n_gen_data(
|
|||||||
if(alutech_at4n_counter_mode == 0) {
|
if(alutech_at4n_counter_mode == 0) {
|
||||||
// Check for OFEX (overflow experimental) mode
|
// Check for OFEX (overflow experimental) mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if(instance->generic.cnt < 0xFFFF) {
|
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||||
}
|
}
|
||||||
} else if(
|
|
||||||
(instance->generic.cnt >= 0xFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
|
|||||||
@@ -192,17 +192,11 @@ static void subghz_protocol_encoder_came_atomo_get_upload(
|
|||||||
if(came_atomo_counter_mode == 0) {
|
if(came_atomo_counter_mode == 0) {
|
||||||
// Check for OFEX (overflow experimental) mode
|
// Check for OFEX (overflow experimental) mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if(instance->generic.cnt < 0xFFFF) {
|
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||||
}
|
}
|
||||||
} else if(
|
|
||||||
(instance->generic.cnt >= 0xFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
|
|||||||
@@ -140,40 +140,35 @@ static bool subghz_protocol_faac_slh_gen_data(SubGhzProtocolEncoderFaacSLH* inst
|
|||||||
uint8_t data_prg[8];
|
uint8_t data_prg[8];
|
||||||
|
|
||||||
data_prg[0] = 0x00;
|
data_prg[0] = 0x00;
|
||||||
|
// faac slh protocol have 20-bit counter so we take only 20 bits from mult (by AND 0xFFFFF)
|
||||||
|
|
||||||
if(allow_zero_seed || (instance->generic.seed != 0x0)) {
|
if(allow_zero_seed || (instance->generic.seed != 0x0)) {
|
||||||
|
// check OFEX mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if(instance->generic.cnt < 0xFFFFF) {
|
if((instance->generic.cnt +
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) >
|
(furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFF)) > 0xFFFFF) {
|
||||||
0xFFFFF) {
|
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt +=
|
||||||
}
|
(furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFF);
|
||||||
} else if(
|
|
||||||
(instance->generic.cnt >= 0xFFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// to do OFEX mode
|
||||||
instance->generic.cnt += 1;
|
instance->generic.cnt += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(temp_counter_backup != 0x0) {
|
if(temp_counter_backup != 0x0) {
|
||||||
|
// check OFEX mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if(temp_counter_backup < 0xFFFFF) {
|
if((temp_counter_backup +
|
||||||
if((temp_counter_backup + furi_hal_subghz_get_rolling_counter_mult()) >
|
(furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFF)) > 0xFFFFF) {
|
||||||
0xFFFFF) {
|
|
||||||
temp_counter_backup = 0;
|
temp_counter_backup = 0;
|
||||||
} else {
|
} else {
|
||||||
temp_counter_backup += furi_hal_subghz_get_rolling_counter_mult();
|
temp_counter_backup +=
|
||||||
}
|
(furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFF);
|
||||||
} else if(
|
|
||||||
(temp_counter_backup >= 0xFFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
temp_counter_backup = 0;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// todo OFEX mode
|
||||||
temp_counter_backup += 1;
|
temp_counter_backup += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,21 +236,19 @@ static bool subghz_protocol_faac_slh_gen_data(SubGhzProtocolEncoderFaacSLH* inst
|
|||||||
fixx[i] = (fix >> (shiftby -= 4)) & 0xF;
|
fixx[i] = (fix >> (shiftby -= 4)) & 0xF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// faac slh protocol have 20-bit counter so we take only 20 bits from mult (by AND 0xFFFFF)
|
||||||
if(allow_zero_seed || (instance->generic.seed != 0x0)) {
|
if(allow_zero_seed || (instance->generic.seed != 0x0)) {
|
||||||
if(!(furi_hal_subghz_get_rolling_counter_mult() >= 0xFFFE)) {
|
// check OFEX mode
|
||||||
if(instance->generic.cnt < 0xFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) >
|
if((instance->generic.cnt + (furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFF)) >
|
||||||
0xFFFFF) {
|
0xFFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt += (furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFF);
|
||||||
}
|
|
||||||
} else if(
|
|
||||||
(instance->generic.cnt >= 0xFFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// OFEX mode
|
||||||
if(instance->generic.cnt < 0xFFFFF) {
|
if(instance->generic.cnt < 0xFFFFF) {
|
||||||
if((instance->generic.cnt + 0xFFFFF) > 0xFFFFF) {
|
if((instance->generic.cnt + 0xFFFFF) > 0xFFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
|
|||||||
@@ -149,19 +149,14 @@ static void subghz_protocol_encoder_hay21_get_upload(SubGhzProtocolEncoderHay21*
|
|||||||
// Counter increment
|
// Counter increment
|
||||||
// Check for OFEX (overflow experimental) mode
|
// Check for OFEX (overflow experimental) mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if(instance->generic.cnt < 0xF) {
|
//not matter how big and long mult - we take only 4 bits ( AND 0xF) beacose hay21 counter have only 4 bits long (0..F)
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xF) {
|
if((instance->generic.cnt + (furi_hal_subghz_get_rolling_counter_mult() & 0xF)) > 0xF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt += (furi_hal_subghz_get_rolling_counter_mult() & 0xF);
|
||||||
}
|
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() >= 0xF) {
|
|
||||||
instance->generic.cnt = 0xF;
|
|
||||||
}
|
|
||||||
} else if(instance->generic.cnt >= 0xF) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// OFEX mode
|
||||||
if((instance->generic.cnt + 0x1) > 0xF) {
|
if((instance->generic.cnt + 0x1) > 0xF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else if(instance->generic.cnt >= 0x1 && instance->generic.cnt != 0xE) {
|
} else if(instance->generic.cnt >= 0x1 && instance->generic.cnt != 0xE) {
|
||||||
|
|||||||
@@ -189,20 +189,11 @@ static bool subghz_protocol_keeloq_gen_data(
|
|||||||
if(keeloq_counter_mode == 0) {
|
if(keeloq_counter_mode == 0) {
|
||||||
// Check for OFEX (overflow experimental) mode
|
// Check for OFEX (overflow experimental) mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
// If counter is 0xFFFF we will reset it to 0
|
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
||||||
if(instance->generic.cnt < 0xFFFF) {
|
|
||||||
// Increase counter with value set in global settings (mult)
|
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) >
|
|
||||||
0xFFFF) {
|
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||||
}
|
}
|
||||||
} else if(
|
|
||||||
(instance->generic.cnt >= 0xFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
|
|||||||
@@ -259,11 +259,13 @@ void subghz_protocol_decoder_kia_get_string(void* context, FuriString* output) {
|
|||||||
uint32_t code_found_hi = instance->generic.data >> 32;
|
uint32_t code_found_hi = instance->generic.data >> 32;
|
||||||
uint32_t code_found_lo = instance->generic.data & 0x00000000ffffffff;
|
uint32_t code_found_lo = instance->generic.data & 0x00000000ffffffff;
|
||||||
|
|
||||||
|
// use 'Cntr:' instead of 'Cnt:' to exclude this protocol counter from Counter edit
|
||||||
furi_string_cat_printf(
|
furi_string_cat_printf(
|
||||||
output,
|
output,
|
||||||
"%s %dbit\r\n"
|
"%s %dbit\r\n"
|
||||||
"Key:%08lX%08lX\r\n"
|
"Key:%08lX%08lX\r\n"
|
||||||
"Sn:%07lX Btn:%X Cnt:%04lX\r\n",
|
"Sn:%07lX Btn:%X\r\n"
|
||||||
|
"Cntr:%04lX\r\n",
|
||||||
instance->generic.protocol_name,
|
instance->generic.protocol_name,
|
||||||
instance->generic.data_count_bit,
|
instance->generic.data_count_bit,
|
||||||
code_found_hi,
|
code_found_hi,
|
||||||
|
|||||||
@@ -159,17 +159,11 @@ static bool subghz_protocol_kinggates_stylo_4k_gen_data(
|
|||||||
|
|
||||||
// Check for OFEX (overflow experimental) mode
|
// Check for OFEX (overflow experimental) mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if(instance->generic.cnt < 0xFFFF) {
|
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||||
}
|
}
|
||||||
} else if(
|
|
||||||
(instance->generic.cnt >= 0xFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
|
|||||||
@@ -159,17 +159,11 @@ static void subghz_protocol_encoder_nice_flor_s_get_upload(
|
|||||||
if(nice_flors_counter_mode == 0) {
|
if(nice_flors_counter_mode == 0) {
|
||||||
// Check for OFEX (overflow experimental) mode
|
// Check for OFEX (overflow experimental) mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if(instance->generic.cnt < 0xFFFF) {
|
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||||
}
|
}
|
||||||
} else if(
|
|
||||||
(instance->generic.cnt >= 0xFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
|
|||||||
@@ -256,17 +256,11 @@ static bool
|
|||||||
// Reconstruction of the data
|
// Reconstruction of the data
|
||||||
// Check for OFEX (overflow experimental) mode
|
// Check for OFEX (overflow experimental) mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if(instance->generic.cnt < 0xFFFF) {
|
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||||
}
|
}
|
||||||
} else if(
|
|
||||||
(instance->generic.cnt >= 0xFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
|
|||||||
@@ -301,11 +301,13 @@ void subghz_protocol_decoder_scher_khan_get_string(void* context, FuriString* ou
|
|||||||
subghz_protocol_scher_khan_check_remote_controller(
|
subghz_protocol_scher_khan_check_remote_controller(
|
||||||
&instance->generic, &instance->protocol_name);
|
&instance->generic, &instance->protocol_name);
|
||||||
|
|
||||||
|
// use 'Cntr:' instead of 'Cnt:' to exclude this protocol counter from Counter edit
|
||||||
furi_string_cat_printf(
|
furi_string_cat_printf(
|
||||||
output,
|
output,
|
||||||
"%s %dbit\r\n"
|
"%s %dbit\r\n"
|
||||||
"Key:0x%lX%08lX\r\n"
|
"Key:0x%lX%08lX\r\n"
|
||||||
"Sn:%07lX Btn:%X Cnt:%04lX\r\n"
|
"Sn:%07lX Btn:%X\r\n"
|
||||||
|
"Cntr:%04lX\r\n"
|
||||||
"Pt: %s\r\n",
|
"Pt: %s\r\n",
|
||||||
instance->generic.protocol_name,
|
instance->generic.protocol_name,
|
||||||
instance->generic.data_count_bit,
|
instance->generic.data_count_bit,
|
||||||
|
|||||||
@@ -220,15 +220,60 @@ static bool subghz_protocol_secplus_v1_encode(SubGhzProtocolEncoderSecPlus_v1* i
|
|||||||
uint32_t acc = 0;
|
uint32_t acc = 0;
|
||||||
|
|
||||||
//increment the counter
|
//increment the counter
|
||||||
rolling += 2;
|
//rolling += 2; - old way
|
||||||
|
// Experemental case - we dont know counter size exactly, so just will be think that it is in range of 0xE6000000 - 0xFFFFFFFF
|
||||||
|
// one case when we have mult = 0xFFFFFFFF - its when we reset counter before applying new cnt value
|
||||||
|
// so at first step we reset cnt to 0 and now we sure here will be second step (set new cnt value);
|
||||||
|
// at second step check what user set for new Cnt (and correct it if cnt less than 0xE6000000 or more than 0xFFFFFFFF)
|
||||||
|
int32_t multicntr = (furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFFFF);
|
||||||
|
// Adjust for negative multiplier
|
||||||
|
if(furi_hal_subghz_get_rolling_counter_mult() < 0) {
|
||||||
|
multicntr = furi_hal_subghz_get_rolling_counter_mult();
|
||||||
|
}
|
||||||
|
if(multicntr == 1) {
|
||||||
|
multicntr = 2; // to keep old behaviour when mult = 1
|
||||||
|
}
|
||||||
|
// Check for OFEX (overflow experimental) mode
|
||||||
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
|
if((furi_hal_subghz_get_rolling_counter_mult() == (int32_t)0xFFFFFFF) & (rolling != 0)) {
|
||||||
|
rolling = 0;
|
||||||
|
} else {
|
||||||
|
// if cnt was reset to 0 on previous step and user want new Cnt then set it to 0xE6000000 or 0xFFFFFFFF or new user value
|
||||||
|
if(rolling == 0) {
|
||||||
|
if((furi_hal_subghz_get_rolling_counter_mult()) < (int32_t)0x6000000) {
|
||||||
|
rolling = 0xE6000000;
|
||||||
|
} else {
|
||||||
|
if((furi_hal_subghz_get_rolling_counter_mult()) >= (int32_t)0xFFFFFFF) {
|
||||||
|
rolling = 0xFFFFFFFF;
|
||||||
|
} else {
|
||||||
|
rolling = 0xE0000000;
|
||||||
|
rolling += multicntr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// if we have not special cases - so work as standart mode
|
||||||
|
if((rolling + multicntr) > 0xFFFFFFFF) {
|
||||||
|
rolling = 0xE6000000;
|
||||||
|
} else {
|
||||||
|
rolling += multicntr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// OFEX (overflow experimental) mode
|
||||||
|
if((rolling + 0x1) > 0xFFFFFFFF) {
|
||||||
|
rolling = 0xE6000000;
|
||||||
|
} else if(rolling >= 0xE6000000 && rolling != 0xFFFFFFFE) {
|
||||||
|
rolling = 0xFFFFFFFE;
|
||||||
|
} else {
|
||||||
|
rolling++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//update data
|
//update data
|
||||||
instance->generic.data &= 0xFFFFFFFF00000000;
|
instance->generic.data &= 0xFFFFFFFF00000000;
|
||||||
instance->generic.data |= rolling;
|
instance->generic.data |= rolling;
|
||||||
|
|
||||||
if(rolling == 0xFFFFFFFF) {
|
|
||||||
rolling = 0xE6000000;
|
|
||||||
}
|
|
||||||
if(fixed > 0xCFD41B90) {
|
if(fixed > 0xCFD41B90) {
|
||||||
FURI_LOG_E(TAG, "Encode wrong fixed data");
|
FURI_LOG_E(TAG, "Encode wrong fixed data");
|
||||||
return false;
|
return false;
|
||||||
@@ -598,10 +643,11 @@ void subghz_protocol_decoder_secplus_v1_get_string(void* context, FuriString* ou
|
|||||||
} else {
|
} else {
|
||||||
furi_string_cat_printf(output, "\r\n");
|
furi_string_cat_printf(output, "\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
furi_string_cat_printf(
|
furi_string_cat_printf(
|
||||||
output,
|
output,
|
||||||
"Sn:0x%08lX\r\n"
|
"Sn:0x%08lX\r\n"
|
||||||
"Cnt:%03lX "
|
"Cnt:%08lX "
|
||||||
"SwID:0x%X\r\n",
|
"SwID:0x%X\r\n",
|
||||||
instance->generic.serial,
|
instance->generic.serial,
|
||||||
instance->generic.cnt,
|
instance->generic.cnt,
|
||||||
@@ -620,7 +666,7 @@ void subghz_protocol_decoder_secplus_v1_get_string(void* context, FuriString* ou
|
|||||||
furi_string_cat_printf(
|
furi_string_cat_printf(
|
||||||
output,
|
output,
|
||||||
"Sn:0x%08lX\r\n"
|
"Sn:0x%08lX\r\n"
|
||||||
"Cnt:%03lX "
|
"Cnt:%08lX "
|
||||||
"SwID:0x%X\r\n",
|
"SwID:0x%X\r\n",
|
||||||
instance->generic.serial,
|
instance->generic.serial,
|
||||||
instance->generic.cnt,
|
instance->generic.cnt,
|
||||||
|
|||||||
@@ -403,10 +403,52 @@ static void subghz_protocol_secplus_v2_encode(SubGhzProtocolEncoderSecPlus_v2* i
|
|||||||
uint8_t roll_1[9] = {0};
|
uint8_t roll_1[9] = {0};
|
||||||
uint8_t roll_2[9] = {0};
|
uint8_t roll_2[9] = {0};
|
||||||
|
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
// Experemental case - we dont know counter size exactly, so just will be think that it is in range of 0xE500000 - 0xFFFFFFF
|
||||||
|
// one case when we have mult = 0xFFFFFFFF - its when we reset counter before applying new cnt value
|
||||||
|
// so at first step we reset cnt to 0 and now we sure here will be second step (set new cnt value);
|
||||||
|
// at second step check what user set for new Cnt (and correct it if cnt less than 0xE500000 or more than 0xFFFFFFF)
|
||||||
|
int32_t multicntr = (furi_hal_subghz_get_rolling_counter_mult() & 0xFFFFFFF);
|
||||||
|
// Adjust for negative multiplier
|
||||||
|
if(furi_hal_subghz_get_rolling_counter_mult() < 0) {
|
||||||
|
multicntr = furi_hal_subghz_get_rolling_counter_mult();
|
||||||
|
}
|
||||||
|
// Check for OFEX (overflow experimental) mode
|
||||||
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
|
if((furi_hal_subghz_get_rolling_counter_mult() == (int32_t)0xFFFFFFF) &
|
||||||
|
(instance->generic.cnt != 0)) {
|
||||||
|
instance->generic.cnt = 0;
|
||||||
|
} else {
|
||||||
|
// if cnt was reset to 0 on previous step and user want new Cnt then set it to 0xE500000 or 0xFFFFFFF or new user value
|
||||||
|
if(instance->generic.cnt == 0) {
|
||||||
|
if(furi_hal_subghz_get_rolling_counter_mult() < (int32_t)0xE500000) {
|
||||||
|
instance->generic.cnt = 0xE500000;
|
||||||
|
} else {
|
||||||
|
if(furi_hal_subghz_get_rolling_counter_mult() >= (int32_t)0xFFFFFFF) {
|
||||||
|
instance->generic.cnt = 0xFFFFFFF;
|
||||||
|
} else {
|
||||||
|
instance->generic.cnt += multicntr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// if we have not special cases - so work as standart mode
|
||||||
|
if((instance->generic.cnt + multicntr) > 0xFFFFFFF) {
|
||||||
|
instance->generic.cnt = 0xE500000;
|
||||||
|
} else {
|
||||||
|
instance->generic.cnt += multicntr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// OFEX (overflow experimental) mode
|
||||||
|
if((instance->generic.cnt + 0x1) > 0xFFFFFFF) {
|
||||||
|
instance->generic.cnt = 0xE500000;
|
||||||
|
} else if(instance->generic.cnt >= 0xE500000 && instance->generic.cnt != 0xFFFFFFE) {
|
||||||
|
instance->generic.cnt = 0xFFFFFFE;
|
||||||
|
} else {
|
||||||
|
instance->generic.cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//ToDo it is not known what value the counter starts
|
|
||||||
if(instance->generic.cnt > 0xFFFFFFF) instance->generic.cnt = 0xE500000;
|
|
||||||
uint32_t rolling = subghz_protocol_blocks_reverse_key(instance->generic.cnt, 28);
|
uint32_t rolling = subghz_protocol_blocks_reverse_key(instance->generic.cnt, 28);
|
||||||
|
|
||||||
for(int8_t i = 17; i > -1; i--) {
|
for(int8_t i = 17; i > -1; i--) {
|
||||||
@@ -941,13 +983,14 @@ void subghz_protocol_decoder_secplus_v2_get_string(void* context, FuriString* ou
|
|||||||
SubGhzProtocolDecoderSecPlus_v2* instance = context;
|
SubGhzProtocolDecoderSecPlus_v2* instance = context;
|
||||||
subghz_protocol_secplus_v2_remote_controller(&instance->generic, instance->secplus_packet_1);
|
subghz_protocol_secplus_v2_remote_controller(&instance->generic, instance->secplus_packet_1);
|
||||||
|
|
||||||
|
// need to research or practice check how much bits in counter
|
||||||
furi_string_cat_printf(
|
furi_string_cat_printf(
|
||||||
output,
|
output,
|
||||||
"%s %db\r\n"
|
"%s %db\r\n"
|
||||||
"Pk1:0x%lX%08lX\r\n"
|
"Pk1:0x%lX%08lX\r\n"
|
||||||
"Pk2:0x%lX%08lX\r\n"
|
"Pk2:0x%lX%08lX\r\n"
|
||||||
"Sn:0x%08lX Btn:0x%01X\r\n"
|
"Sn:0x%08lX Btn:0x%01X\r\n"
|
||||||
"Cnt:%03lX\r\n",
|
"Cnt:%07lX\r\n",
|
||||||
|
|
||||||
instance->generic.protocol_name,
|
instance->generic.protocol_name,
|
||||||
instance->generic.data_count_bit,
|
instance->generic.data_count_bit,
|
||||||
|
|||||||
@@ -134,17 +134,11 @@ static bool
|
|||||||
|
|
||||||
// Check for OFEX (overflow experimental) mode
|
// Check for OFEX (overflow experimental) mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if(instance->generic.cnt < 0xFFFF) {
|
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||||
}
|
}
|
||||||
} else if(
|
|
||||||
(instance->generic.cnt >= 0xFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
|
|||||||
@@ -128,17 +128,11 @@ static bool subghz_protocol_somfy_telis_gen_data(
|
|||||||
|
|
||||||
// Check for OFEX (overflow experimental) mode
|
// Check for OFEX (overflow experimental) mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if(instance->generic.cnt < 0xFFFF) {
|
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||||
}
|
}
|
||||||
} else if(
|
|
||||||
(instance->generic.cnt >= 0xFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
|
|||||||
@@ -134,17 +134,11 @@ static bool
|
|||||||
subghz_protocol_star_line_gen_data(SubGhzProtocolEncoderStarLine* instance, uint8_t btn) {
|
subghz_protocol_star_line_gen_data(SubGhzProtocolEncoderStarLine* instance, uint8_t btn) {
|
||||||
// Check for OFEX (overflow experimental) mode
|
// Check for OFEX (overflow experimental) mode
|
||||||
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
if(furi_hal_subghz_get_rolling_counter_mult() != -0x7FFFFFFF) {
|
||||||
if(instance->generic.cnt < 0xFFFF) {
|
|
||||||
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
if((instance->generic.cnt + furi_hal_subghz_get_rolling_counter_mult()) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
} else {
|
} else {
|
||||||
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
instance->generic.cnt += furi_hal_subghz_get_rolling_counter_mult();
|
||||||
}
|
}
|
||||||
} else if(
|
|
||||||
(instance->generic.cnt >= 0xFFFF) &&
|
|
||||||
(furi_hal_subghz_get_rolling_counter_mult() != 0)) {
|
|
||||||
instance->generic.cnt = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
if((instance->generic.cnt + 0x1) > 0xFFFF) {
|
||||||
instance->generic.cnt = 0;
|
instance->generic.cnt = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user