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:
Skorpionm
2021-08-16 23:56:23 +04:00
committed by GitHub
parent a548525d75
commit a024e470b7
37 changed files with 1059 additions and 672 deletions

View File

@@ -10,7 +10,7 @@
#define bit_clear(value, bit) ((value) &= ~(1UL << (bit)))
#define bit_write(value, bit, bitvalue) (bitvalue ? bit_set(value, bit) : bit_clear(value, bit))
#define SUBGHZ_TX_PIN_HIGTH()
#define SUBGHZ_TX_PIN_HIGH()
#define SUBGHZ_TX_PIN_LOW()
#define DURATION_DIFF(x, y) ((x < y) ? (y - x) : (x - y))
@@ -18,8 +18,13 @@
#define SUBGHZ_APP_FOLDER "/any/subghz"
#define SUBGHZ_APP_PATH_FOLDER "/any/subghz/saved"
#define SUBGHZ_APP_EXTENSION ".sub"
#define SUBGHZ_ENCODER_UPLOAD_MAX_SIZE 512
#define TYPE_PROTOCOL_STATIC 1u
#define TYPE_PROTOCOL_DYNAMIC 2u
typedef struct SubGhzProtocolCommon SubGhzProtocolCommon;
typedef struct SubGhzProtocolEncoderCommon SubGhzProtocolEncoderCommon;
typedef void (*SubGhzProtocolCommonCallback)(SubGhzProtocolCommon* parser, void* context);
@@ -31,10 +36,13 @@ typedef void (*SubGhzProtocolCommonGetStrSave)(SubGhzProtocolCommon* instance, s
//Load
typedef bool (*SubGhzProtocolCommonLoad)(FileWorker* file_worker, SubGhzProtocolCommon* instance);
//Get upload encoder protocol
typedef bool (*SubGhzProtocolEncoderCommonGetUpLoad)(SubGhzProtocolCommon* instance, SubGhzProtocolEncoderCommon* encoder);
struct SubGhzProtocolCommon {
const char* name;
uint16_t te_long;
uint16_t te_shot;
uint16_t te_short;
uint16_t te_delta;
uint8_t code_count_bit;
uint8_t code_last_count_bit;
@@ -42,6 +50,7 @@ struct SubGhzProtocolCommon {
uint64_t code_last_found;
uint8_t code_min_count_bit_for_found;
uint8_t parser_step;
uint8_t type_protocol;
uint32_t te_last;
uint8_t header_count;
uint16_t cnt;
@@ -58,8 +67,23 @@ struct SubGhzProtocolCommon {
SubGhzProtocolCommonGetStrSave to_save_string;
/*Load protocol by file*/
SubGhzProtocolCommonLoad to_load_protocol;
/*Get upload encoder protocol*/
SubGhzProtocolEncoderCommonGetUpLoad get_upload_protocol;
};
struct SubGhzProtocolEncoderCommon {
bool start;
size_t repeat;
size_t front;
size_t size_upload;
LevelDuration* upload;
};
SubGhzProtocolEncoderCommon* subghz_protocol_encoder_common_alloc();
void subghz_protocol_encoder_common_free(SubGhzProtocolEncoderCommon* instance);
size_t subghz_encoder_common_get_repeat_left(SubGhzProtocolEncoderCommon* instance);
LevelDuration subghz_protocol_encoder_common_yield(void* context);
/** Add data bit to code_found
*
* @param common - SubGhzProtocolCommon common
@@ -104,3 +128,5 @@ void subghz_protocol_common_set_callback(
* @param output - output string
*/
void subghz_protocol_common_to_str(SubGhzProtocolCommon* instance, string_t output);
bool subghz_protocol_common_read_hex(string_t str, uint8_t* buff, uint16_t len);