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-12-22 11:05:14 +00:00
|
|
|
#include "../helpers/subghz_testing.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-12-13 12:21:37 +00:00
|
|
|
#define SUBGHZ_TEST_PACKET_COUNT 500
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
struct SubghzTestPacket {
|
|
|
|
View* view;
|
2021-12-21 12:16:25 +00:00
|
|
|
osTimerId_t 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-09-28 00:05:40 +00:00
|
|
|
SubghzTestPacketCallback callback;
|
|
|
|
void* context;
|
2021-03-31 17:52:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
SubghzTestPacketModelStatusRx,
|
2021-09-28 00:05:40 +00:00
|
|
|
SubghzTestPacketModelStatusOnlyRx,
|
2021-03-31 17:52:26 +00:00
|
|
|
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;
|
|
|
|
|
2021-09-28 00:05:40 +00:00
|
|
|
void subghz_test_packet_set_callback(
|
|
|
|
SubghzTestPacket* subghz_test_packet,
|
|
|
|
SubghzTestPacketCallback callback,
|
|
|
|
void* context) {
|
|
|
|
furi_assert(subghz_test_packet);
|
|
|
|
furi_assert(callback);
|
|
|
|
subghz_test_packet->callback = callback;
|
|
|
|
subghz_test_packet->context = context;
|
|
|
|
}
|
|
|
|
|
2021-07-18 18:09:00 +00:00
|
|
|
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;
|
2021-09-28 00:05:40 +00:00
|
|
|
} else if(model->status == SubghzTestPacketModelStatusTx) {
|
[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
|
|
|
|
2021-08-23 23:52:59 +00:00
|
|
|
if(event->key == InputKeyBack || event->type != InputTypeShort) {
|
2021-03-31 17:52:26 +00:00
|
|
|
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-09-28 00:05:40 +00:00
|
|
|
} else if(model->status == SubghzTestPacketModelStatusTx) {
|
2021-12-13 12:21:37 +00:00
|
|
|
subghz_encoder_princeton_stop(instance->encoder, millis());
|
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
|
|
|
|
2021-08-23 23:52:59 +00:00
|
|
|
if(event->key == InputKeyLeft) {
|
|
|
|
if(model->frequency > 0) model->frequency--;
|
|
|
|
} else if(event->key == InputKeyRight) {
|
2021-12-22 11:05:14 +00:00
|
|
|
if(model->frequency < subghz_frequencies_count_testing - 1) model->frequency++;
|
2021-08-23 23:52:59 +00:00
|
|
|
} else if(event->key == InputKeyDown) {
|
|
|
|
if(model->path > 0) model->path--;
|
|
|
|
} else if(event->key == InputKeyUp) {
|
|
|
|
if(model->path < FuriHalSubGhzPath868) model->path++;
|
|
|
|
} else if(event->key == InputKeyOk) {
|
2021-09-28 00:05:40 +00:00
|
|
|
if(model->status == SubghzTestPacketModelStatusRx) {
|
2021-08-23 23:52:59 +00:00
|
|
|
model->status = SubghzTestPacketModelStatusTx;
|
2021-09-28 00:05:40 +00:00
|
|
|
} else {
|
|
|
|
model->status = SubghzTestPacketModelStatusRx;
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-23 23:52:59 +00:00
|
|
|
model->real_frequency =
|
2021-12-22 11:05:14 +00:00
|
|
|
furi_hal_subghz_set_frequency(subghz_frequencies_testing[model->frequency]);
|
2021-08-23 23:52:59 +00:00
|
|
|
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 {
|
2021-09-28 00:05:40 +00:00
|
|
|
subghz_encoder_princeton_set(
|
2021-12-13 12:21:37 +00:00
|
|
|
instance->encoder,
|
|
|
|
0x00AABBCC,
|
|
|
|
SUBGHZ_TEST_PACKET_COUNT,
|
2021-12-22 11:05:14 +00:00
|
|
|
subghz_frequencies_testing[model->frequency]);
|
2021-09-28 00:05:40 +00:00
|
|
|
if(!furi_hal_subghz_start_async_tx(
|
|
|
|
subghz_encoder_princeton_yield, instance->encoder)) {
|
|
|
|
model->status = SubghzTestPacketModelStatusOnlyRx;
|
|
|
|
instance->callback(SubghzTestPacketEventOnlyRx, instance->context);
|
|
|
|
}
|
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();
|
Skorp subghz signal archive (#667)
* SubGhz: Add millis() furi, add subghz history struct
* SubGhz: Fix subghz history
* Gubghz: Fix code repeat history, add clean history
* SubGhz: reading and adding keys to history
* Gui: Renaming Sub 1-Ghz -> SubGhz
* Archive: Renaming Sub 1-Ghz -> SubGhz
* SubGhz: Add menu history, modified button for sending a signal, changed output of data about accepted protocol
* Archive: Fix name subghz
* SubGhz: Menu navigation
* Assets: Add assets/SubGHz/icon.png
* Assets: add new icons for subghz
* SubGhz: Fix name Add manually scene
* SubGhz: Fix load icon Read scene. rename encoder struct, rename protocol function load from file, add load raw data protocol, add info pleasant signals all protocol
* SubGhz: fix memory leak
* SubGhz: change of receiving frequency for read scene
* SubGhz: Add save/load frequency and preset, add automatic configuration of transmit/receive to the desired frequency and modulation, add button "save" config scene
* SubGhz: Fix frequency and preset, fix frequency add manualli scene, fix re-executing the parser
* Furi-hal-subghz: add 2-FSK config, fix ook config 650KHz BW Tx filter
* Fix formatting and release build
* SubGhz: Delete read scene
* SubGhz: Fix frequency add manualli scene, refactoring code
* SubGhz: 2 profiles for OOK, fix broken build.
* SubGhz: Add passing static codes from read scene, add notification read scene, refactoring code
* SubGhz: fix assert on worker double stop.
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2021-08-28 13:51:48 +00:00
|
|
|
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOok650Async);
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
with_view_model(
|
2021-07-18 18:09:00 +00:00
|
|
|
instance->view, (SubghzTestPacketModel * model) {
|
2021-12-22 11:05:14 +00:00
|
|
|
model->frequency = subghz_frequencies_433_92_testing;
|
2021-03-31 17:52:26 +00:00
|
|
|
model->real_frequency =
|
2021-12-22 11:05:14 +00:00
|
|
|
furi_hal_subghz_set_frequency(subghz_frequencies_testing[model->frequency]);
|
2021-08-08 18:03:25 +00:00
|
|
|
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-11-22 18:49:57 +00:00
|
|
|
osTimerStart(instance->timer, osKernelGetTickFreq() / 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-09-28 00:05:40 +00:00
|
|
|
} else if(model->status == SubghzTestPacketModelStatusTx) {
|
2021-12-13 12:21:37 +00:00
|
|
|
subghz_encoder_princeton_stop(instance->encoder, millis());
|
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();
|
2021-08-23 23:52:59 +00:00
|
|
|
view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(SubghzTestPacketModel));
|
2021-07-18 18:09:00 +00:00
|
|
|
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-12-21 12:16:25 +00:00
|
|
|
}
|