[FL-1237] Notifications app (#476)
* Notification app: init * Notification app: separate message sequences * Notification app: rename notifications to notification * Notification app: rework api * Notification app: new sequences for charger * Power app: add state for better led handling * Power app: NotificationSequence type, notification led process * Blink app: use notifications * Notification app: sound and vibro notifications * Notification app: note messages * Notification app: more messages * Notification app: update note message generator * Blink app: fix state counter * Notification app: fix delay event * App sd-filesystem: notifications * App notifications: headers c++ compatibility * App notifications: Cmaj success chord sequence * App iButton: use notifications * App notification: display backlight notifications * App notification: add "display on" message to success and error sequences * App accessor: use notifications * App ibutton: guard onewire key read * Lib-RFAL: remove api_hal_light usage * App notification: add blocking mode, rework display api * Cli led command: use internal notification instead of direc access to leds. * App unit test: use notifications * App lfrfid: use notifications * Apps: close notification record * App subghz: rough use of notifications * App notificaton: ignore reset flag * App strobe: removed * Lib irda decoder: fix nec decoding * App irda: fix assert, use notifications * Apps: use notifications * Fix IRDA tests * Cli: better var naming * App notification: readable sources Co-authored-by: Albert Kharisov <albert@flipperdevices.com> Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -3,11 +3,9 @@
|
||||
#include <furi.h>
|
||||
#include "../irda_i.h"
|
||||
|
||||
|
||||
static bool interpret_nec(IrdaCommonDecoder* decoder);
|
||||
static DecodeStatus decode_repeat_nec(IrdaCommonDecoder* decoder);
|
||||
|
||||
|
||||
static const IrdaCommonProtocolSpec protocol_nec = {
|
||||
{
|
||||
IRDA_NEC_PREAMBULE_MARK,
|
||||
@@ -25,17 +23,15 @@ static const IrdaCommonProtocolSpec protocol_nec = {
|
||||
decode_repeat_nec,
|
||||
};
|
||||
|
||||
|
||||
static bool interpret_nec(IrdaCommonDecoder* decoder) {
|
||||
furi_assert(decoder);
|
||||
|
||||
bool result = false;
|
||||
uint8_t address = decoder->data[0];
|
||||
uint8_t address_inverse = decoder->data[1];
|
||||
uint16_t address = decoder->data[0] | (decoder->data[1] << 8);
|
||||
uint8_t command = decoder->data[2];
|
||||
uint8_t command_inverse = decoder->data[3];
|
||||
|
||||
if ((command == (uint8_t) ~command_inverse) && (address == (uint8_t) ~address_inverse)) {
|
||||
if((command == (uint8_t)~command_inverse)) {
|
||||
decoder->message.command = command;
|
||||
decoder->message.address = address;
|
||||
decoder->message.repeat = false;
|
||||
@@ -53,14 +49,13 @@ static DecodeStatus decode_repeat_nec(IrdaCommonDecoder* decoder) {
|
||||
uint32_t bit_tolerance = decoder->protocol->timings.bit_tolerance;
|
||||
DecodeStatus status = DecodeStatusError;
|
||||
|
||||
if (decoder->timings_cnt < 4)
|
||||
return DecodeStatusOk;
|
||||
if(decoder->timings_cnt < 4) return DecodeStatusOk;
|
||||
|
||||
if ((decoder->timings[0] > IRDA_NEC_REPEAT_PAUSE_MIN)
|
||||
&& (decoder->timings[0] < IRDA_NEC_REPEAT_PAUSE_MAX)
|
||||
&& MATCH_PREAMBLE_TIMING(decoder->timings[1], IRDA_NEC_REPEAT_MARK, preamble_tolerance)
|
||||
&& MATCH_PREAMBLE_TIMING(decoder->timings[2], IRDA_NEC_REPEAT_SPACE, preamble_tolerance)
|
||||
&& MATCH_BIT_TIMING(decoder->timings[3], decoder->protocol->timings.bit1_mark, bit_tolerance)) {
|
||||
if((decoder->timings[0] > IRDA_NEC_REPEAT_PAUSE_MIN) &&
|
||||
(decoder->timings[0] < IRDA_NEC_REPEAT_PAUSE_MAX) &&
|
||||
MATCH_PREAMBLE_TIMING(decoder->timings[1], IRDA_NEC_REPEAT_MARK, preamble_tolerance) &&
|
||||
MATCH_PREAMBLE_TIMING(decoder->timings[2], IRDA_NEC_REPEAT_SPACE, preamble_tolerance) &&
|
||||
MATCH_BIT_TIMING(decoder->timings[3], decoder->protocol->timings.bit1_mark, bit_tolerance)) {
|
||||
status = DecodeStatusReady;
|
||||
decoder->timings_cnt = 0;
|
||||
} else {
|
||||
@@ -81,4 +76,3 @@ IrdaMessage* irda_decoder_nec_decode(void* decoder, bool level, uint32_t duratio
|
||||
void irda_decoder_nec_free(void* decoder) {
|
||||
irda_common_decoder_free(decoder);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user