Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSkorpionm <85568270+Skorpionm@users.noreply.github.com>2021-09-28 03:05:40 +0300
committerGitHub <noreply@github.com>2021-09-28 03:05:40 +0300
commita8981d317a0f36e6694e8edc891103eecb5fae7a (patch)
tree309a0d7ff9668721ee733a4bfa57bd9813375d6a /applications/subghz/views/subghz_test_packet.c
parent416e1bda3519020d3dbcf9b5e66e693fcfa66279 (diff)
[FL-1815, FL-1851, FL-1856] SubGhz: preparation for certification, add deleting stored signals and rename file in SubGHz app (#714)
* [FL-1811] FuriHal: move core2 startup to hal init stage, prevent working with flash controller till core2 startup finish. #704 * SubGhz: fix GO0 low on last hop transmission, decreased DutyCycle in tests * SubGhz: test_static fix max 5 sec in transmission mode, DutyCycle <23% * [FL-1815] SubGhz: prohibiting transmission if it is not within the permitted range for the given region * SubGhz: fix F7 furi-hal-subghz * SubGhz: fix logic working tests * SubGhz: fix princeton encoder for test * SubGhz: add log princeton encoder * [FL-1856] Subghz: fix output a double error if the file cannot be opened * [FL-1851] SubGhz: add deleting Stored Signals in SubGHz App * SubGhz: add rename file SubGhz app * SubGhz: update stats message in princeton * SubGhz: correct spelling * SubGhz: fix FM config, add hardware signal processing less than 16 μs, add added filter for processing short signals * SubGhz: add Scher-Khan MAGICAR Dinamic protocol * SubGhz: sync fury targets Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'applications/subghz/views/subghz_test_packet.c')
-rw-r--r--applications/subghz/views/subghz_test_packet.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/applications/subghz/views/subghz_test_packet.c b/applications/subghz/views/subghz_test_packet.c
index f1c48179..2d4b4aea 100644
--- a/applications/subghz/views/subghz_test_packet.c
+++ b/applications/subghz/views/subghz_test_packet.c
@@ -16,12 +16,14 @@ struct SubghzTestPacket {
SubGhzDecoderPrinceton* decoder;
SubGhzEncoderPrinceton* encoder;
-
volatile size_t packet_rx;
+ SubghzTestPacketCallback callback;
+ void* context;
};
typedef enum {
SubghzTestPacketModelStatusRx,
+ SubghzTestPacketModelStatusOnlyRx,
SubghzTestPacketModelStatusTx,
} SubghzTestPacketModelStatus;
@@ -36,6 +38,16 @@ typedef struct {
volatile bool subghz_test_packet_overrun = false;
+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;
+}
+
static void subghz_test_packet_rx_callback(bool level, uint32_t duration, void* context) {
furi_assert(context);
SubghzTestPacket* instance = context;
@@ -57,7 +69,7 @@ static void subghz_test_packet_rssi_timer_callback(void* context) {
if(model->status == SubghzTestPacketModelStatusRx) {
model->rssi = furi_hal_subghz_get_rssi();
model->packets = instance->packet_rx;
- } else {
+ } else if(model->status == SubghzTestPacketModelStatusTx) {
model->packets = SUBGHZ_TEST_PACKET_COUNT -
subghz_encoder_princeton_get_repeat_left(instance->encoder);
}
@@ -124,7 +136,7 @@ static bool subghz_test_packet_input(InputEvent* event, void* context) {
instance->view, (SubghzTestPacketModel * model) {
if(model->status == SubghzTestPacketModelStatusRx) {
furi_hal_subghz_stop_async_rx();
- } else {
+ } else if(model->status == SubghzTestPacketModelStatusTx) {
furi_hal_subghz_stop_async_tx();
}
@@ -137,10 +149,10 @@ static bool subghz_test_packet_input(InputEvent* event, void* context) {
} else if(event->key == InputKeyUp) {
if(model->path < FuriHalSubGhzPath868) model->path++;
} else if(event->key == InputKeyOk) {
- if(model->status == SubghzTestPacketModelStatusTx) {
- model->status = SubghzTestPacketModelStatusRx;
- } else {
+ if(model->status == SubghzTestPacketModelStatusRx) {
model->status = SubghzTestPacketModelStatusTx;
+ } else {
+ model->status = SubghzTestPacketModelStatusRx;
}
}
@@ -151,8 +163,13 @@ static bool subghz_test_packet_input(InputEvent* event, void* context) {
if(model->status == SubghzTestPacketModelStatusRx) {
furi_hal_subghz_start_async_rx(subghz_test_packet_rx_callback, instance);
} else {
- subghz_encoder_princeton_set(instance->encoder, 0x00AABBCC, 1000);
- furi_hal_subghz_start_async_tx(subghz_encoder_princeton_yield, instance->encoder);
+ subghz_encoder_princeton_set(
+ instance->encoder, 0x00AABBCC, SUBGHZ_TEST_PACKET_COUNT);
+ if(!furi_hal_subghz_start_async_tx(
+ subghz_encoder_princeton_yield, instance->encoder)) {
+ model->status = SubghzTestPacketModelStatusOnlyRx;
+ instance->callback(SubghzTestPacketEventOnlyRx, instance->context);
+ }
}
return true;
@@ -195,7 +212,7 @@ void subghz_test_packet_exit(void* context) {
instance->view, (SubghzTestPacketModel * model) {
if(model->status == SubghzTestPacketModelStatusRx) {
furi_hal_subghz_stop_async_rx();
- } else {
+ } else if(model->status == SubghzTestPacketModelStatusTx) {
furi_hal_subghz_stop_async_tx();
}
return true;
@@ -240,4 +257,4 @@ void subghz_test_packet_free(SubghzTestPacket* instance) {
View* subghz_test_packet_get_view(SubghzTestPacket* instance) {
furi_assert(instance);
return instance->view;
-}
+} \ No newline at end of file