mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-29 04:09:58 -07:00
Change custom btn sending logic
This commit is contained in:
@@ -4,11 +4,13 @@ static uint8_t custom_btn_id = SUBGHZ_CUSTOM_BTN_OK;
|
||||
static uint8_t custom_btn_original = 0;
|
||||
static uint8_t custom_btn_max_btns = 0;
|
||||
|
||||
void subghz_custom_btn_set(uint8_t btn_id) {
|
||||
bool subghz_custom_btn_set(uint8_t btn_id) {
|
||||
if(btn_id > custom_btn_max_btns) {
|
||||
custom_btn_id = SUBGHZ_CUSTOM_BTN_OK;
|
||||
return false;
|
||||
} else {
|
||||
custom_btn_id = btn_id;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,4 +33,8 @@ void subghz_custom_btn_set_max(uint8_t b) {
|
||||
void subghz_custom_btns_reset() {
|
||||
custom_btn_original = 0;
|
||||
custom_btn_max_btns = 0;
|
||||
}
|
||||
|
||||
bool subghz_custom_btn_is_allowed() {
|
||||
return custom_btn_max_btns != 0;
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
#define SUBGHZ_CUSTOM_BTN_LEFT (3U)
|
||||
#define SUBGHZ_CUSTOM_BTN_RIGHT (4U)
|
||||
|
||||
void subghz_custom_btn_set(uint8_t btn_id);
|
||||
bool subghz_custom_btn_set(uint8_t btn_id);
|
||||
|
||||
uint8_t subghz_custom_btn_get();
|
||||
|
||||
@@ -21,4 +21,6 @@ uint8_t subghz_custom_btn_get_original();
|
||||
|
||||
void subghz_custom_btn_set_max(uint8_t b);
|
||||
|
||||
void subghz_custom_btns_reset();
|
||||
void subghz_custom_btns_reset();
|
||||
|
||||
bool subghz_custom_btn_is_allowed();
|
||||
Reference in New Issue
Block a user