[FL-2912] Forced RAW receive option for Infrared CLI #1891

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Georgii Surkov
2022-10-18 17:10:21 +03:00
committed by GitHub
parent 4942bd2105
commit 02c27becb0
3 changed files with 47 additions and 18 deletions

View File

@@ -57,6 +57,7 @@ struct InfraredWorker {
InfraredDecoderHandler* infrared_decoder;
NotificationApp* notification;
bool blink_enable;
bool decode_enable;
union {
struct {
@@ -131,7 +132,8 @@ static void infrared_worker_process_timeout(InfraredWorker* instance) {
static void
infrared_worker_process_timings(InfraredWorker* instance, uint32_t duration, bool level) {
const InfraredMessage* message_decoded =
infrared_decode(instance->infrared_decoder, level, duration);
instance->decode_enable ? infrared_decode(instance->infrared_decoder, level, duration) :
NULL;
if(message_decoded) {
instance->signal.message = *message_decoded;
instance->signal.timings_cnt = 0;
@@ -233,6 +235,7 @@ InfraredWorker* infrared_worker_alloc() {
instance->infrared_decoder = infrared_alloc_decoder();
instance->infrared_encoder = infrared_alloc_encoder();
instance->blink_enable = false;
instance->decode_enable = true;
instance->notification = furi_record_open(RECORD_NOTIFICATION);
instance->state = InfraredWorkerStateIdle;
@@ -316,6 +319,11 @@ void infrared_worker_rx_enable_blink_on_receiving(InfraredWorker* instance, bool
instance->blink_enable = enable;
}
void infrared_worker_rx_enable_signal_decoding(InfraredWorker* instance, bool enable) {
furi_assert(instance);
instance->decode_enable = enable;
}
void infrared_worker_tx_start(InfraredWorker* instance) {
furi_assert(instance);
furi_assert(instance->state == InfraredWorkerStateIdle);

View File

@@ -76,6 +76,14 @@ void infrared_worker_rx_set_received_signal_callback(
*/
void infrared_worker_rx_enable_blink_on_receiving(InfraredWorker* instance, bool enable);
/** Enable decoding of received infrared signals.
*
* @param[in] instance - instance of InfraredWorker
* @param[in] enable - true if you want to enable decoding
* false otherwise
*/
void infrared_worker_rx_enable_signal_decoding(InfraredWorker* instance, bool enable);
/** Clarify is received signal either decoded or raw
*
* @param[in] signal - received signal