debug in subghz only when compiled with DEBUG=1

This commit is contained in:
MX 2022-10-02 07:34:39 +03:00
parent 85eb740559
commit e2faf31b45
No known key found for this signature in database
GPG Key ID: 6C4C311DFD4B4AB5
8 changed files with 25 additions and 3 deletions

View File

@ -12,10 +12,12 @@ ADD_SCENE(subghz, show_only_rx, ShowOnlyRx)
ADD_SCENE(subghz, saved_menu, SavedMenu)
ADD_SCENE(subghz, delete, Delete)
ADD_SCENE(subghz, delete_success, DeleteSuccess)
#if FURI_DEBUG
ADD_SCENE(subghz, test, Test)
ADD_SCENE(subghz, test_static, TestStatic)
ADD_SCENE(subghz, test_carrier, TestCarrier)
ADD_SCENE(subghz, test_packet, TestPacket)
#endif
ADD_SCENE(subghz, set_type, SetType)
ADD_SCENE(subghz, set_fix_faac_868, SetFixFaac868)
ADD_SCENE(subghz, set_cnt_faac_868, SetCntFaac868)

View File

@ -49,10 +49,12 @@ void subghz_scene_start_on_enter(void* context) {
SubmenuIndexFrequencyAnalyzer,
subghz_scene_start_submenu_callback,
subghz);
#if FURI_DEBUG
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
submenu_add_item(
subghz->submenu, "Test", SubmenuIndexTest, subghz_scene_start_submenu_callback, subghz);
}
#endif
submenu_set_selected_item(
subghz->submenu, scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneStart));
@ -93,12 +95,16 @@ bool subghz_scene_start_on_event(void* context, SceneManagerEvent event) {
subghz->scene_manager, SubGhzSceneStart, SubmenuIndexFrequencyAnalyzer);
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneFrequencyAnalyzer);
return true;
} else if(event.event == SubmenuIndexTest) {
}
#if FURI_DEBUG
else if(event.event == SubmenuIndexTest) {
scene_manager_set_scene_state(
subghz->scene_manager, SubGhzSceneStart, SubmenuIndexTest);
scene_manager_next_scene(subghz->scene_manager, SubGhzSceneTest);
return true;
}
#endif
}
return false;
}

View File

@ -1,3 +1,4 @@
#if FURI_DEBUG
#include "../subghz_i.h"
enum SubmenuIndex {
@ -59,3 +60,4 @@ void subghz_scene_test_on_exit(void* context) {
SubGhz* subghz = context;
submenu_reset(subghz->submenu);
}
#endif

View File

@ -1,3 +1,4 @@
#if FURI_DEBUG
#include "../subghz_i.h"
#include "../views/subghz_test_carrier.h"
@ -28,3 +29,4 @@ bool subghz_scene_test_carrier_on_event(void* context, SceneManagerEvent event)
void subghz_scene_test_carrier_on_exit(void* context) {
UNUSED(context);
}
#endif

View File

@ -1,3 +1,4 @@
#if FURI_DEBUG
#include "../subghz_i.h"
#include "../views/subghz_test_packet.h"
@ -28,3 +29,4 @@ bool subghz_scene_test_packet_on_event(void* context, SceneManagerEvent event) {
void subghz_scene_test_packet_on_exit(void* context) {
UNUSED(context);
}
#endif

View File

@ -1,3 +1,4 @@
#if FURI_DEBUG
#include "../subghz_i.h"
#include "../views/subghz_test_static.h"
@ -28,3 +29,4 @@ bool subghz_scene_test_static_on_event(void* context, SceneManagerEvent event) {
void subghz_scene_test_static_on_exit(void* context) {
UNUSED(context);
}
#endif

View File

@ -151,6 +151,7 @@ SubGhz* subghz_alloc() {
SubGhzViewIdReadRAW,
subghz_read_raw_get_view(subghz->subghz_read_raw));
#if FURI_DEBUG
// Carrier Test Module
subghz->subghz_test_carrier = subghz_test_carrier_alloc();
view_dispatcher_add_view(
@ -171,6 +172,7 @@ SubGhz* subghz_alloc() {
subghz->view_dispatcher,
SubGhzViewIdStatic,
subghz_test_static_get_view(subghz->subghz_test_static));
#endif
//init setting
subghz->setting = subghz_setting_alloc();
@ -239,6 +241,7 @@ void subghz_free(SubGhz* subghz) {
subghz->rpc_ctx = NULL;
}
#if FURI_DEBUG
// Packet Test
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdTestPacket);
subghz_test_packet_free(subghz->subghz_test_packet);
@ -250,7 +253,7 @@ void subghz_free(SubGhz* subghz) {
// Static
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdStatic);
subghz_test_static_free(subghz->subghz_test_static);
#endif
// Receiver
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdReceiver);
subghz_view_receiver_free(subghz->subghz_receiver);

View File

@ -7,10 +7,11 @@
#include "views/subghz_frequency_analyzer.h"
#include "views/subghz_read_raw.h"
#if FURI_DEBUG
#include "views/subghz_test_static.h"
#include "views/subghz_test_carrier.h"
#include "views/subghz_test_packet.h"
#endif
// #include <furi.h>
// #include <furi_hal.h>
#include <gui/gui.h>
@ -96,9 +97,11 @@ struct SubGhz {
SubGhzFrequencyAnalyzer* subghz_frequency_analyzer;
SubGhzReadRAW* subghz_read_raw;
#if FURI_DEBUG
SubGhzTestStatic* subghz_test_static;
SubGhzTestCarrier* subghz_test_carrier;
SubGhzTestPacket* subghz_test_packet;
#endif
string_t error_str;
SubGhzSetting* setting;
SubGhzLastSettings* last_settings;