SubGhz: read and save static remotes. Create new static and dynamic remotes. (#646)
* SubGhz: the functions of saving loading KeeLog have been modified, saving KeeLog is prohibited * SubGhz: Fix displaying Nice FlorS in the Raed scene * SubGhz: Fix displaying Faac SLH in the Raed scene * SubGhz: Fix displaying iDo in the Raed scene * SubGhz: Fix displaying Star Line in the Raed scene * SubGhz: Fix displaying Nice Flo in the Raed scene, added save and load functions. (testing needed, no remote control) * SubGhz: subghz_beginadded common encoder upload signal * SubGhz: add Came encoder * SubGhz: modified pricenton encoder, fix view transmitter hide the "Send" button if there is no encoder * SubGhz: add nice flo encoder, need testing no remote control * SubGhz: add gate_tx encoder * SubGhz: add nero_sketch encoder * SubGhz: add keelog encoder * SubGhz: add long upload upload while the button is pressed while releasing the transfer is over, with a check for sticking (maximum 200 upload repetitions) * SubGhz: fix max upload * SubGhz: Fix structure subghz add encoder * SubGhz: add generating and sending a dynamic keelog key, refactoring the code * SubGhz: add notifications * SubGhz: add creating a new remote control (Pricenton, Nice Flo 12bit, Nice Flo 24bit, CAME 12bit, CAME 24bit, Gate TX, DoorHan) * SubGhz: Fix load file, fix scene start * Subghz: Fix show key * SubGhz: Fix subghz_cli * SubGhz: Fix furi-hal-subghz * Format sources * SubGhz: standard notification scheme, fix broken assert in DMA. * SubGhz: move level alignment logic to furi-hal-subghz, fix spelling, cleanup. Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -22,9 +22,10 @@ SubGhzProtocolStarLine* subghz_protocol_star_line_alloc(SubGhzKeystore* keystore
|
||||
|
||||
instance->common.name = "Star Line";
|
||||
instance->common.code_min_count_bit_for_found = 64;
|
||||
instance->common.te_shot = 250;
|
||||
instance->common.te_short = 250;
|
||||
instance->common.te_long = 500;
|
||||
instance->common.te_delta = 120;
|
||||
instance->common.type_protocol = TYPE_PROTOCOL_DYNAMIC;
|
||||
instance->common.to_string = (SubGhzProtocolCommonToStr)subghz_protocol_star_line_to_str;
|
||||
|
||||
return instance;
|
||||
@@ -43,16 +44,16 @@ void subghz_protocol_star_line_free(SubGhzProtocolStarLine* instance) {
|
||||
void subghz_protocol_star_line_send_bit(SubGhzProtocolStarLine* instance, uint8_t bit) {
|
||||
if (bit) {
|
||||
//send bit 1
|
||||
SUBGHZ_TX_PIN_HIGTH();
|
||||
SUBGHZ_TX_PIN_HIGH();
|
||||
delay_us(instance->common.te_long);
|
||||
SUBGHZ_TX_PIN_LOW();
|
||||
delay_us(instance->common.te_long);
|
||||
} else {
|
||||
//send bit 0
|
||||
SUBGHZ_TX_PIN_HIGTH();
|
||||
delay_us(instance->common.te_shot);
|
||||
SUBGHZ_TX_PIN_HIGH();
|
||||
delay_us(instance->common.te_short);
|
||||
SUBGHZ_TX_PIN_LOW();
|
||||
delay_us(instance->common.te_shot);
|
||||
delay_us(instance->common.te_short);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +61,7 @@ void subghz_protocol_star_line_send_key(SubGhzProtocolStarLine* instance, uint64
|
||||
while (repeat--) {
|
||||
//Send header
|
||||
for(uint8_t i = 0; i < 6; i++){
|
||||
SUBGHZ_TX_PIN_HIGTH();
|
||||
SUBGHZ_TX_PIN_HIGH();
|
||||
delay_us(instance->common.te_long * 2);
|
||||
SUBGHZ_TX_PIN_LOW();
|
||||
delay_us(instance->common.te_long * 2);
|
||||
@@ -174,7 +175,7 @@ uint8_t subghz_protocol_star_line_check_remote_controller_selector(SubGhzProtoco
|
||||
* @param instance SubGhzProtocolStarLine instance
|
||||
*/
|
||||
void subghz_protocol_star_line_check_remote_controller(SubGhzProtocolStarLine* instance) {
|
||||
uint64_t key = subghz_protocol_common_reverse_key(instance->common.code_found, instance->common.code_count_bit);
|
||||
uint64_t key = subghz_protocol_common_reverse_key(instance->common.code_last_found, instance->common.code_last_count_bit);
|
||||
uint32_t key_fix = key >> 32;
|
||||
uint32_t key_hop = key & 0x00000000ffffffff;
|
||||
|
||||
@@ -182,10 +183,6 @@ void subghz_protocol_star_line_check_remote_controller(SubGhzProtocolStarLine* i
|
||||
|
||||
instance ->common.serial= key_fix&0x00FFFFFF;
|
||||
instance->common.btn = key_fix >> 24;
|
||||
|
||||
|
||||
if (instance->common.callback) instance->common.callback((SubGhzProtocolCommon*)instance, instance->common.context);
|
||||
|
||||
}
|
||||
|
||||
void subghz_protocol_star_line_parse(SubGhzProtocolStarLine* instance, bool level, uint32_t duration) {
|
||||
@@ -222,7 +219,9 @@ void subghz_protocol_star_line_parse(SubGhzProtocolStarLine* instance, bool leve
|
||||
instance->common.parser_step = 0;
|
||||
if (instance->common.code_count_bit>= instance->common.code_min_count_bit_for_found) {
|
||||
if(instance->common.code_last_found != instance->common.code_found){
|
||||
subghz_protocol_star_line_check_remote_controller(instance);
|
||||
instance->common.code_last_found = instance->common.code_found;
|
||||
instance->common.code_last_count_bit = instance->common.code_count_bit;
|
||||
if (instance->common.callback) instance->common.callback((SubGhzProtocolCommon*)instance, instance->common.context);
|
||||
}
|
||||
}
|
||||
instance->common.code_found = 0;
|
||||
@@ -240,8 +239,8 @@ void subghz_protocol_star_line_parse(SubGhzProtocolStarLine* instance, bool leve
|
||||
break;
|
||||
case 3:
|
||||
if(!level){
|
||||
if ((DURATION_DIFF(instance->common.te_last,instance->common.te_shot)< instance->common.te_delta)
|
||||
&& (DURATION_DIFF(duration,instance->common.te_shot)< instance->common.te_delta)) {
|
||||
if ((DURATION_DIFF(instance->common.te_last,instance->common.te_short)< instance->common.te_delta)
|
||||
&& (DURATION_DIFF(duration,instance->common.te_short)< instance->common.te_delta)) {
|
||||
subghz_protocol_common_add_bit(&instance->common, 0);
|
||||
instance->common.parser_step = 2;
|
||||
} else if ((DURATION_DIFF(instance->common.te_last,instance->common.te_long )< instance->common.te_delta)
|
||||
@@ -259,22 +258,23 @@ void subghz_protocol_star_line_parse(SubGhzProtocolStarLine* instance, bool leve
|
||||
}
|
||||
|
||||
void subghz_protocol_star_line_to_str(SubGhzProtocolStarLine* instance, string_t output) {
|
||||
uint32_t code_found_hi = instance->common.code_found >> 32;
|
||||
uint32_t code_found_lo = instance->common.code_found & 0x00000000ffffffff;
|
||||
subghz_protocol_star_line_check_remote_controller(instance);
|
||||
uint32_t code_found_hi = instance->common.code_last_found >> 32;
|
||||
uint32_t code_found_lo = instance->common.code_last_found & 0x00000000ffffffff;
|
||||
|
||||
uint64_t code_found_reverse = subghz_protocol_common_reverse_key(instance->common.code_found, instance->common.code_count_bit);
|
||||
uint64_t code_found_reverse = subghz_protocol_common_reverse_key(instance->common.code_last_found, instance->common.code_last_count_bit);
|
||||
|
||||
uint32_t code_found_reverse_hi = code_found_reverse>>32;
|
||||
uint32_t code_found_reverse_lo = code_found_reverse&0x00000000ffffffff;
|
||||
string_cat_printf(
|
||||
output,
|
||||
"Protocol %s, %d Bit\r\n"
|
||||
"%s, %d Bit\r\n"
|
||||
"KEY:0x%lX%lX\r\n"
|
||||
"FIX:%08lX MF:%s \r\n"
|
||||
"HOP:%08lX \r\n"
|
||||
"SN:%06lX CNT:%04X B:%02lX\r\n",
|
||||
instance->common.name,
|
||||
instance->common.code_count_bit,
|
||||
instance->common.code_last_count_bit,
|
||||
code_found_hi,
|
||||
code_found_lo,
|
||||
code_found_reverse_hi,
|
||||
|
Reference in New Issue
Block a user