2021-03-31 17:52:26 +00:00
|
|
|
#include "subghz_test_packet.h"
|
2021-06-29 21:19:20 +00:00
|
|
|
#include "../subghz_i.h"
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
#include <furi.h>
|
2021-08-08 18:03:25 +00:00
|
|
|
#include <furi-hal.h>
|
2021-03-31 17:52:26 +00:00
|
|
|
#include <input/input.h>
|
2021-07-18 18:09:00 +00:00
|
|
|
#include <toolbox/level_duration.h>
|
|
|
|
#include <lib/subghz/protocols/subghz_protocol_princeton.h>
|
2021-03-31 17:52:26 +00:00
|
|
|
|
2021-07-18 18:09:00 +00:00
|
|
|
#define SUBGHZ_TEST_PACKET_COUNT 1000
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
struct SubghzTestPacket {
|
|
|
|
View* view;
|
|
|
|
osTimerId timer;
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
|
|
|
|
|
|
|
SubGhzDecoderPrinceton* decoder;
|
|
|
|
SubGhzEncoderPrinceton* encoder;
|
2021-07-18 18:09:00 +00:00
|
|
|
|
|
|
|
volatile size_t packet_rx;
|
2021-03-31 17:52:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
SubghzTestPacketModelStatusRx,
|
|
|
|
SubghzTestPacketModelStatusTx,
|
|
|
|
} SubghzTestPacketModelStatus;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t frequency;
|
|
|
|
uint32_t real_frequency;
|
2021-08-08 18:03:25 +00:00
|
|
|
FuriHalSubGhzPath path;
|
2021-03-31 17:52:26 +00:00
|
|
|
float rssi;
|
2021-07-18 18:09:00 +00:00
|
|
|
size_t packets;
|
2021-03-31 17:52:26 +00:00
|
|
|
SubghzTestPacketModelStatus status;
|
|
|
|
} SubghzTestPacketModel;
|
|
|
|
|
2021-07-18 18:09:00 +00:00
|
|
|
volatile bool subghz_test_packet_overrun = false;
|
|
|
|
|
|
|
|
static void subghz_test_packet_rx_callback(bool level, uint32_t duration, void* context) {
|
|
|
|
furi_assert(context);
|
|
|
|
SubghzTestPacket* instance = context;
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
|
|
|
subghz_decoder_princeton_parse(instance->decoder, level, duration);
|
2021-07-18 18:09:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void subghz_test_packet_rx_pt_callback(SubGhzProtocolCommon* parser, void* context) {
|
|
|
|
furi_assert(context);
|
|
|
|
SubghzTestPacket* instance = context;
|
|
|
|
instance->packet_rx++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void subghz_test_packet_rssi_timer_callback(void* context) {
|
|
|
|
furi_assert(context);
|
|
|
|
SubghzTestPacket* instance = context;
|
|
|
|
|
|
|
|
with_view_model(
|
|
|
|
instance->view, (SubghzTestPacketModel * model) {
|
|
|
|
if(model->status == SubghzTestPacketModelStatusRx) {
|
2021-08-08 18:03:25 +00:00
|
|
|
model->rssi = furi_hal_subghz_get_rssi();
|
2021-07-18 18:09:00 +00:00
|
|
|
model->packets = instance->packet_rx;
|
|
|
|
} else {
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
|
|
|
model->packets = SUBGHZ_TEST_PACKET_COUNT -
|
|
|
|
subghz_encoder_princeton_get_repeat_left(instance->encoder);
|
2021-07-18 18:09:00 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
static void subghz_test_packet_draw(Canvas* canvas, SubghzTestPacketModel* model) {
|
2021-03-31 17:52:26 +00:00
|
|
|
char buffer[64];
|
|
|
|
|
|
|
|
canvas_set_color(canvas, ColorBlack);
|
|
|
|
canvas_set_font(canvas, FontPrimary);
|
2021-07-04 16:01:16 +00:00
|
|
|
canvas_draw_str(canvas, 0, 8, "CC1101 Packet Test");
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
canvas_set_font(canvas, FontSecondary);
|
|
|
|
// Frequency
|
|
|
|
snprintf(
|
|
|
|
buffer,
|
|
|
|
sizeof(buffer),
|
|
|
|
"Freq: %03ld.%03ld.%03ld Hz",
|
|
|
|
model->real_frequency / 1000000 % 1000,
|
|
|
|
model->real_frequency / 1000 % 1000,
|
|
|
|
model->real_frequency % 1000);
|
2021-07-04 16:01:16 +00:00
|
|
|
canvas_draw_str(canvas, 0, 20, buffer);
|
2021-03-31 17:52:26 +00:00
|
|
|
// Path
|
|
|
|
char* path_name = "Unknown";
|
2021-08-08 18:03:25 +00:00
|
|
|
if(model->path == FuriHalSubGhzPathIsolate) {
|
2021-03-31 17:52:26 +00:00
|
|
|
path_name = "isolate";
|
2021-08-08 18:03:25 +00:00
|
|
|
} else if(model->path == FuriHalSubGhzPath433) {
|
2021-03-31 17:52:26 +00:00
|
|
|
path_name = "433MHz";
|
2021-08-08 18:03:25 +00:00
|
|
|
} else if(model->path == FuriHalSubGhzPath315) {
|
2021-03-31 17:52:26 +00:00
|
|
|
path_name = "315MHz";
|
2021-08-08 18:03:25 +00:00
|
|
|
} else if(model->path == FuriHalSubGhzPath868) {
|
2021-03-31 17:52:26 +00:00
|
|
|
path_name = "868MHz";
|
|
|
|
}
|
|
|
|
snprintf(buffer, sizeof(buffer), "Path: %d - %s", model->path, path_name);
|
2021-07-04 16:01:16 +00:00
|
|
|
canvas_draw_str(canvas, 0, 31, buffer);
|
2021-07-18 18:09:00 +00:00
|
|
|
|
|
|
|
snprintf(buffer, sizeof(buffer), "Packets: %d", model->packets);
|
|
|
|
canvas_draw_str(canvas, 0, 42, buffer);
|
|
|
|
|
2021-03-31 17:52:26 +00:00
|
|
|
if(model->status == SubghzTestPacketModelStatusRx) {
|
|
|
|
snprintf(
|
|
|
|
buffer,
|
|
|
|
sizeof(buffer),
|
|
|
|
"RSSI: %ld.%ld dBm",
|
|
|
|
(int32_t)(model->rssi),
|
|
|
|
(int32_t)fabs(model->rssi * 10) % 10);
|
2021-07-18 18:09:00 +00:00
|
|
|
canvas_draw_str(canvas, 0, 53, buffer);
|
2021-03-31 17:52:26 +00:00
|
|
|
} else {
|
2021-07-18 18:09:00 +00:00
|
|
|
canvas_draw_str(canvas, 0, 53, "TX");
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-18 18:09:00 +00:00
|
|
|
static bool subghz_test_packet_input(InputEvent* event, void* context) {
|
2021-03-31 17:52:26 +00:00
|
|
|
furi_assert(context);
|
2021-07-18 18:09:00 +00:00
|
|
|
SubghzTestPacket* instance = context;
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
if(event->key == InputKeyBack) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
with_view_model(
|
2021-07-18 18:09:00 +00:00
|
|
|
instance->view, (SubghzTestPacketModel * model) {
|
|
|
|
if(model->status == SubghzTestPacketModelStatusRx) {
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_stop_async_rx();
|
2021-07-18 18:09:00 +00:00
|
|
|
} else {
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_stop_async_tx();
|
2021-07-18 18:09:00 +00:00
|
|
|
}
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
if(event->type == InputTypeShort) {
|
|
|
|
if(event->key == InputKeyLeft) {
|
|
|
|
if(model->frequency > 0) model->frequency--;
|
|
|
|
} else if(event->key == InputKeyRight) {
|
|
|
|
if(model->frequency < subghz_frequencies_count - 1) model->frequency++;
|
|
|
|
} else if(event->key == InputKeyDown) {
|
|
|
|
if(model->path > 0) model->path--;
|
|
|
|
} else if(event->key == InputKeyUp) {
|
2021-08-08 18:03:25 +00:00
|
|
|
if(model->path < FuriHalSubGhzPath868) model->path++;
|
2021-05-25 10:19:07 +00:00
|
|
|
} else if(event->key == InputKeyOk) {
|
|
|
|
if(model->status == SubghzTestPacketModelStatusTx) {
|
|
|
|
model->status = SubghzTestPacketModelStatusRx;
|
|
|
|
} else {
|
|
|
|
model->status = SubghzTestPacketModelStatusTx;
|
|
|
|
}
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model->real_frequency =
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_set_frequency(subghz_frequencies[model->frequency]);
|
|
|
|
furi_hal_subghz_set_path(model->path);
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(model->status == SubghzTestPacketModelStatusRx) {
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
|
|
|
furi_hal_subghz_start_async_rx(subghz_test_packet_rx_callback, instance);
|
2021-03-31 17:52:26 +00:00
|
|
|
} else {
|
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>
2021-08-16 19:56:23 +00:00
|
|
|
subghz_encoder_princeton_set(instance->encoder, 0x00AABBCC, 1000);
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
|
|
|
furi_hal_subghz_start_async_tx(subghz_encoder_princeton_yield, instance->encoder);
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void subghz_test_packet_enter(void* context) {
|
|
|
|
furi_assert(context);
|
2021-07-18 18:09:00 +00:00
|
|
|
SubghzTestPacket* instance = context;
|
|
|
|
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_reset();
|
|
|
|
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync);
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
with_view_model(
|
2021-07-18 18:09:00 +00:00
|
|
|
instance->view, (SubghzTestPacketModel * model) {
|
2021-05-25 10:19:07 +00:00
|
|
|
model->frequency = subghz_frequencies_433_92;
|
2021-03-31 17:52:26 +00:00
|
|
|
model->real_frequency =
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_set_frequency(subghz_frequencies[model->frequency]);
|
|
|
|
model->path = FuriHalSubGhzPathIsolate; // isolate
|
2021-03-31 17:52:26 +00:00
|
|
|
model->rssi = 0.0f;
|
|
|
|
model->status = SubghzTestPacketModelStatusRx;
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
|
|
|
furi_hal_subghz_start_async_rx(subghz_test_packet_rx_callback, instance);
|
2021-03-31 17:52:26 +00:00
|
|
|
|
2021-07-18 18:09:00 +00:00
|
|
|
osTimerStart(instance->timer, 1024 / 4);
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void subghz_test_packet_exit(void* context) {
|
|
|
|
furi_assert(context);
|
2021-07-18 18:09:00 +00:00
|
|
|
SubghzTestPacket* instance = context;
|
2021-03-31 17:52:26 +00:00
|
|
|
|
2021-07-18 18:09:00 +00:00
|
|
|
osTimerStop(instance->timer);
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
// Reinitialize IC to default state
|
|
|
|
with_view_model(
|
2021-07-18 18:09:00 +00:00
|
|
|
instance->view, (SubghzTestPacketModel * model) {
|
|
|
|
if(model->status == SubghzTestPacketModelStatusRx) {
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_stop_async_rx();
|
2021-07-18 18:09:00 +00:00
|
|
|
} else {
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_stop_async_tx();
|
2021-07-18 18:09:00 +00:00
|
|
|
}
|
2021-03-31 17:52:26 +00:00
|
|
|
return true;
|
|
|
|
});
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_sleep();
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SubghzTestPacket* subghz_test_packet_alloc() {
|
2021-07-18 18:09:00 +00:00
|
|
|
SubghzTestPacket* instance = furi_alloc(sizeof(SubghzTestPacket));
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
// View allocation and configuration
|
2021-07-18 18:09:00 +00:00
|
|
|
instance->view = view_alloc();
|
|
|
|
view_allocate_model(instance->view, ViewModelTypeLockFree, sizeof(SubghzTestPacketModel));
|
|
|
|
view_set_context(instance->view, instance);
|
|
|
|
view_set_draw_callback(instance->view, (ViewDrawCallback)subghz_test_packet_draw);
|
|
|
|
view_set_input_callback(instance->view, subghz_test_packet_input);
|
|
|
|
view_set_enter_callback(instance->view, subghz_test_packet_enter);
|
|
|
|
view_set_exit_callback(instance->view, subghz_test_packet_exit);
|
|
|
|
|
|
|
|
instance->timer =
|
|
|
|
osTimerNew(subghz_test_packet_rssi_timer_callback, osTimerPeriodic, instance, NULL);
|
|
|
|
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
|
|
|
instance->decoder = subghz_decoder_princeton_alloc();
|
2021-07-18 18:09:00 +00:00
|
|
|
subghz_protocol_common_set_callback(
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
|
|
|
(SubGhzProtocolCommon*)instance->decoder, subghz_test_packet_rx_pt_callback, instance);
|
|
|
|
instance->encoder = subghz_encoder_princeton_alloc();
|
2021-07-18 18:09:00 +00:00
|
|
|
|
|
|
|
return instance;
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
2021-07-18 18:09:00 +00:00
|
|
|
void subghz_test_packet_free(SubghzTestPacket* instance) {
|
|
|
|
furi_assert(instance);
|
|
|
|
|
[FL-1610] SubGhz: scene based application, PT save and replay (#630)
* SubGhz: scene based application
* SubGhz: encoder/decoder separation, DMA streaming, update app and cli.
* SubGhz: 2 stage async tx complete, minor cleanup
* SubGhz: 2 stage async tx complete, FIX state pin end transmit
* SubGhz: Pricenton, receive TE signal
* SubGhz: Pricenton, add save data, add load data
* SubGhz: Add Read scene, Fix pricenton save, load funtion
* SubGhz: Add Read, Receiver, SaveName scene
* SubGhz: Read and Save (pricenton)
* SubGhz: add Load scence
* SubGhz: Fix select file scene, add load scene, add transmitter view, add send tx pricenton
* SubGhz: Fix pricenton encoder, fix transmitter send
* SubGhz: modified Pricenton Encoder (added guard time at the beginning), modified CC1101 config, code refactoring
* SubGhz: Fix pricenton encoder defalut TE
* Archive: Fix path and name SubGhz
* Archive: Fix name app SubGhz
* GubGhz: Came: add Save, Load key
* GubGhz: GateTX: add Save, Load key
* GubGhz: NeroSketch: add Save, Load key
* Github: better linters triggers
* SubGhz: adding fast loading keys Archive -> Run in app
* GubGhz: KeeLog: add Save, Load key, key generation from the serial number of the meter and the button
* SubGhz: format sources and fix compilation
* FuriHal: add subghz configuration description for AGC section
* SubGhz: save only protocols that can be saved. Cleanup.
* Github: lint on pull requests
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-12 14:42:56 +00:00
|
|
|
subghz_decoder_princeton_free(instance->decoder);
|
|
|
|
subghz_encoder_princeton_free(instance->encoder);
|
|
|
|
|
2021-07-18 18:09:00 +00:00
|
|
|
osTimerDelete(instance->timer);
|
|
|
|
view_free(instance->view);
|
|
|
|
free(instance);
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
2021-07-18 18:09:00 +00:00
|
|
|
View* subghz_test_packet_get_view(SubghzTestPacket* instance) {
|
|
|
|
furi_assert(instance);
|
|
|
|
return instance->view;
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|