[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
|
|
|
#include "subghz_test_carrier.h"
|
2023-07-06 15:15:03 +00:00
|
|
|
#include "../subghz_test_app_i.h"
|
|
|
|
#include "../helpers/subghz_test_frequency.h"
|
2023-07-03 10:36:26 +00:00
|
|
|
#include <lib/subghz/devices/cc1101_configs.h>
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
#include <furi.h>
|
2022-01-05 16:10:18 +00:00
|
|
|
#include <furi_hal.h>
|
2021-03-31 17:52:26 +00:00
|
|
|
#include <input/input.h>
|
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
struct SubGhzTestCarrier {
|
2021-03-31 17:52:26 +00:00
|
|
|
View* view;
|
2022-07-20 10:56:33 +00:00
|
|
|
FuriTimer* timer;
|
2022-03-03 09:48:56 +00:00
|
|
|
SubGhzTestCarrierCallback callback;
|
2023-07-07 12:45:59 +00:00
|
|
|
// const SubGhzDevice* radio_device;
|
2021-09-28 00:05:40 +00:00
|
|
|
void* context;
|
2021-03-31 17:52:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef enum {
|
2022-03-03 09:48:56 +00:00
|
|
|
SubGhzTestCarrierModelStatusRx,
|
|
|
|
SubGhzTestCarrierModelStatusTx,
|
|
|
|
} SubGhzTestCarrierModelStatus;
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
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;
|
2022-03-03 09:48:56 +00:00
|
|
|
SubGhzTestCarrierModelStatus status;
|
|
|
|
} SubGhzTestCarrierModel;
|
2021-03-31 17:52:26 +00:00
|
|
|
|
2021-09-28 00:05:40 +00:00
|
|
|
void subghz_test_carrier_set_callback(
|
2022-03-03 09:48:56 +00:00
|
|
|
SubGhzTestCarrier* subghz_test_carrier,
|
|
|
|
SubGhzTestCarrierCallback callback,
|
2021-09-28 00:05:40 +00:00
|
|
|
void* context) {
|
|
|
|
furi_assert(subghz_test_carrier);
|
|
|
|
furi_assert(callback);
|
|
|
|
subghz_test_carrier->callback = callback;
|
|
|
|
subghz_test_carrier->context = context;
|
|
|
|
}
|
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
void subghz_test_carrier_draw(Canvas* canvas, SubGhzTestCarrierModel* 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 Basic 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);
|
2022-03-03 09:48:56 +00:00
|
|
|
if(model->status == SubGhzTestCarrierModelStatusRx) {
|
2021-03-31 17:52:26 +00:00
|
|
|
snprintf(
|
|
|
|
buffer,
|
|
|
|
sizeof(buffer),
|
|
|
|
"RSSI: %ld.%ld dBm",
|
|
|
|
(int32_t)(model->rssi),
|
|
|
|
(int32_t)fabs(model->rssi * 10) % 10);
|
2021-07-04 16:01:16 +00:00
|
|
|
canvas_draw_str(canvas, 0, 42, buffer);
|
2021-03-31 17:52:26 +00:00
|
|
|
} else {
|
2021-07-04 16:01:16 +00:00
|
|
|
canvas_draw_str(canvas, 0, 42, "TX");
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[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
|
|
|
bool subghz_test_carrier_input(InputEvent* event, void* context) {
|
2021-03-31 17:52:26 +00:00
|
|
|
furi_assert(context);
|
2022-03-03 09:48:56 +00:00
|
|
|
SubGhzTestCarrier* subghz_test_carrier = context;
|
2023-07-07 12:45:59 +00:00
|
|
|
// const SubGhzDevice* radio_device = subghz_test_carrier->radio_device;
|
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(
|
2022-10-08 17:38:29 +00:00
|
|
|
subghz_test_carrier->view,
|
|
|
|
SubGhzTestCarrierModel * model,
|
|
|
|
{
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_idle();
|
2023-07-07 12:45:59 +00:00
|
|
|
// subghz_devices_idle(radio_device);
|
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) {
|
2022-03-03 09:48:56 +00:00
|
|
|
if(model->status == SubGhzTestCarrierModelStatusTx) {
|
|
|
|
model->status = SubGhzTestCarrierModelStatusRx;
|
2021-08-23 23:52:59 +00:00
|
|
|
} else {
|
2022-03-03 09:48:56 +00:00
|
|
|
model->status = SubGhzTestCarrierModelStatusTx;
|
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);
|
2023-07-07 12:45:59 +00:00
|
|
|
// model->real_frequency = subghz_devices_set_frequency(
|
|
|
|
// radio_device, subghz_frequencies_testing[model->frequency]);
|
2021-08-23 23:52:59 +00:00
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
if(model->status == SubGhzTestCarrierModelStatusRx) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_rx();
|
2023-07-07 12:45:59 +00:00
|
|
|
// furi_hal_gpio_init(
|
|
|
|
// subghz_devices_get_data_gpio(radio_device),
|
|
|
|
// GpioModeInput,
|
|
|
|
// GpioPullNo,
|
|
|
|
// GpioSpeedLow);
|
|
|
|
// subghz_devices_set_rx(radio_device);
|
2021-03-31 17:52:26 +00:00
|
|
|
} else {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_init(
|
2023-06-18 18:09:07 +00:00
|
|
|
&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
|
|
|
furi_hal_gpio_write(&gpio_cc1101_g0, true);
|
2021-09-28 00:05:40 +00:00
|
|
|
if(!furi_hal_subghz_tx()) {
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
2021-09-28 00:05:40 +00:00
|
|
|
subghz_test_carrier->callback(
|
2022-03-03 09:48:56 +00:00
|
|
|
SubGhzTestCarrierEventOnlyRx, subghz_test_carrier->context);
|
2021-09-28 00:05:40 +00:00
|
|
|
}
|
2023-07-07 12:45:59 +00:00
|
|
|
// if(!subghz_devices_set_tx(radio_device)) {
|
|
|
|
// furi_hal_gpio_init(
|
|
|
|
// subghz_devices_get_data_gpio(radio_device),
|
|
|
|
// GpioModeInput,
|
|
|
|
// GpioPullNo,
|
|
|
|
// GpioSpeedLow);
|
|
|
|
// subghz_test_carrier->callback(
|
|
|
|
// SubGhzTestCarrierEventOnlyRx, subghz_test_carrier->context);
|
|
|
|
// }
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
2022-10-08 17:38:29 +00:00
|
|
|
},
|
|
|
|
true);
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
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
|
|
|
void subghz_test_carrier_enter(void* context) {
|
2021-03-31 17:52:26 +00:00
|
|
|
furi_assert(context);
|
2022-03-03 09:48:56 +00:00
|
|
|
SubGhzTestCarrier* subghz_test_carrier = context;
|
2023-07-07 12:45:59 +00:00
|
|
|
// furi_assert(subghz_test_carrier->radio_device);
|
|
|
|
// const SubGhzDevice* radio_device = subghz_test_carrier->radio_device;
|
2023-07-06 13:50:25 +00:00
|
|
|
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_reset();
|
2023-06-30 14:03:36 +00:00
|
|
|
furi_hal_subghz_load_custom_preset(subghz_device_cc1101_preset_ook_650khz_async_regs);
|
2023-07-06 13:50:25 +00:00
|
|
|
|
2022-03-30 15:23:40 +00:00
|
|
|
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
2021-03-31 17:52:26 +00:00
|
|
|
|
2023-07-07 12:45:59 +00:00
|
|
|
// subghz_devices_reset(radio_device);
|
|
|
|
// subghz_devices_load_preset(radio_device, FuriHalSubGhzPresetOok650Async, NULL);
|
2021-03-31 17:52:26 +00:00
|
|
|
|
2023-07-07 12:45:59 +00:00
|
|
|
// furi_hal_gpio_init(
|
|
|
|
// subghz_devices_get_data_gpio(radio_device), GpioModeInput, GpioPullNo, GpioSpeedLow);
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
with_view_model(
|
2022-10-08 17:38:29 +00:00
|
|
|
subghz_test_carrier->view,
|
|
|
|
SubGhzTestCarrierModel * model,
|
|
|
|
{
|
2021-12-22 11:05:14 +00:00
|
|
|
model->frequency = subghz_frequencies_433_92_testing; // 433
|
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]);
|
2023-07-07 12:45:59 +00:00
|
|
|
// model->real_frequency = subghz_devices_set_frequency(
|
|
|
|
// radio_device, 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;
|
2022-03-03 09:48:56 +00:00
|
|
|
model->status = SubGhzTestCarrierModelStatusRx;
|
2022-10-08 17:38:29 +00:00
|
|
|
},
|
|
|
|
true);
|
2021-03-31 17:52:26 +00:00
|
|
|
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_rx();
|
2023-07-07 12:45:59 +00:00
|
|
|
// subghz_devices_set_rx(radio_device);
|
2021-03-31 17:52:26 +00:00
|
|
|
|
2022-07-20 10:56:33 +00:00
|
|
|
furi_timer_start(subghz_test_carrier->timer, furi_kernel_get_tick_frequency() / 4);
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
[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
|
|
|
void subghz_test_carrier_exit(void* context) {
|
2021-03-31 17:52:26 +00:00
|
|
|
furi_assert(context);
|
2022-03-03 09:48:56 +00:00
|
|
|
SubGhzTestCarrier* subghz_test_carrier = context;
|
2021-03-31 17:52:26 +00:00
|
|
|
|
2022-07-20 10:56:33 +00:00
|
|
|
furi_timer_stop(subghz_test_carrier->timer);
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
// Reinitialize IC to default state
|
2021-08-08 18:03:25 +00:00
|
|
|
furi_hal_subghz_sleep();
|
2023-07-07 12:45:59 +00:00
|
|
|
// subghz_devices_sleep(subghz_test_carrier->radio_device);
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
[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
|
|
|
void subghz_test_carrier_rssi_timer_callback(void* context) {
|
2021-03-31 17:52:26 +00:00
|
|
|
furi_assert(context);
|
2022-03-03 09:48:56 +00:00
|
|
|
SubGhzTestCarrier* subghz_test_carrier = context;
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
with_view_model(
|
2022-10-08 17:38:29 +00:00
|
|
|
subghz_test_carrier->view,
|
|
|
|
SubGhzTestCarrierModel * model,
|
|
|
|
{
|
2022-03-03 09:48:56 +00:00
|
|
|
if(model->status == SubGhzTestCarrierModelStatusRx) {
|
2021-08-23 23:52:59 +00:00
|
|
|
model->rssi = furi_hal_subghz_get_rssi();
|
2023-07-07 12:45:59 +00:00
|
|
|
// model->rssi = subghz_devices_get_rssi(subghz_test_carrier->radio_device);
|
2021-08-23 23:52:59 +00:00
|
|
|
}
|
2022-10-08 17:38:29 +00:00
|
|
|
},
|
|
|
|
false);
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
SubGhzTestCarrier* subghz_test_carrier_alloc() {
|
|
|
|
SubGhzTestCarrier* subghz_test_carrier = malloc(sizeof(SubGhzTestCarrier));
|
2021-03-31 17:52:26 +00:00
|
|
|
|
|
|
|
// View allocation and configuration
|
[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_test_carrier->view = view_alloc();
|
2021-03-31 17:52:26 +00:00
|
|
|
view_allocate_model(
|
2022-03-03 09:48:56 +00:00
|
|
|
subghz_test_carrier->view, ViewModelTypeLocking, sizeof(SubGhzTestCarrierModel));
|
[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
|
|
|
view_set_context(subghz_test_carrier->view, subghz_test_carrier);
|
|
|
|
view_set_draw_callback(subghz_test_carrier->view, (ViewDrawCallback)subghz_test_carrier_draw);
|
|
|
|
view_set_input_callback(subghz_test_carrier->view, subghz_test_carrier_input);
|
|
|
|
view_set_enter_callback(subghz_test_carrier->view, subghz_test_carrier_enter);
|
|
|
|
view_set_exit_callback(subghz_test_carrier->view, subghz_test_carrier_exit);
|
|
|
|
|
2022-07-20 10:56:33 +00:00
|
|
|
subghz_test_carrier->timer = furi_timer_alloc(
|
|
|
|
subghz_test_carrier_rssi_timer_callback, FuriTimerTypePeriodic, subghz_test_carrier);
|
[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
|
|
|
|
|
|
|
return subghz_test_carrier;
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
void subghz_test_carrier_free(SubGhzTestCarrier* subghz_test_carrier) {
|
[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_assert(subghz_test_carrier);
|
2022-07-20 10:56:33 +00:00
|
|
|
furi_timer_free(subghz_test_carrier->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
|
|
|
view_free(subghz_test_carrier->view);
|
|
|
|
free(subghz_test_carrier);
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
|
|
|
|
2022-03-03 09:48:56 +00:00
|
|
|
View* subghz_test_carrier_get_view(SubGhzTestCarrier* subghz_test_carrier) {
|
[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_assert(subghz_test_carrier);
|
|
|
|
return subghz_test_carrier->view;
|
2021-03-31 17:52:26 +00:00
|
|
|
}
|
2023-07-06 13:50:25 +00:00
|
|
|
|
2023-07-07 12:45:59 +00:00
|
|
|
// void subghz_test_carrier_set_radio(
|
|
|
|
// SubGhzTestCarrier* subghz_test_carrier,
|
|
|
|
// const SubGhzDevice* radio_device) {
|
|
|
|
// furi_assert(subghz_test_carrier);
|
|
|
|
// subghz_test_carrier->radio_device = radio_device;
|
|
|
|
// }
|