Skip to content

Commit 1b45037

Browse files
authored
Merge pull request #4 from leedave/feature/subghz_updates
Debugging SubGhz RXTX
2 parents 03cd4ba + 52f1e75 commit 1b45037

File tree

5 files changed

+36
-28
lines changed

5 files changed

+36
-28
lines changed

helpers/subghz/subghz.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void subghz_send(void* context) {
3333

3434
if(!flipper_format_file_open_existing(ff, MEAL_PAGER_TMP_FILE)) {
3535
//totp_close_config_file(fff_file);
36-
FURI_LOG_E(TAG, "Error creating new file %s", MEAL_PAGER_TMP_FILE);
36+
FURI_LOG_E(TAG, "Error reading Temp File %s", MEAL_PAGER_TMP_FILE);
3737
furi_record_close(RECORD_STORAGE);
3838
return;
3939
}

helpers/subghz/subghz_txrx.c

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#define TAG "SubGhz"
88

9-
/*static void subghz_txrx_radio_device_power_on(SubGhzTxRx* instance) {
9+
static void subghz_txrx_radio_device_power_on(SubGhzTxRx* instance) {
1010
UNUSED(instance);
1111
uint8_t attempts = 5;
1212
while(--attempts > 0) {
@@ -20,7 +20,7 @@
2020
furi_hal_power_check_otg_fault() ? 1 : 0);
2121
}
2222
}
23-
}*/
23+
}
2424

2525
static void subghz_txrx_radio_device_power_off(SubGhzTxRx* instance) {
2626
UNUSED(instance);
@@ -39,14 +39,14 @@ SubGhzTxRx* subghz_txrx_alloc() {
3939

4040
instance->txrx_state = SubGhzTxRxStateSleep;
4141

42-
//subghz_txrx_hopper_set_state(instance, SubGhzHopperStateOFF);
43-
//subghz_txrx_speaker_set_state(instance, SubGhzSpeakerStateDisable);
42+
subghz_txrx_hopper_set_state(instance, SubGhzHopperStateOFF);
43+
subghz_txrx_speaker_set_state(instance, SubGhzSpeakerStateDisable);
4444

4545
instance->worker = subghz_worker_alloc();
4646
/* instance->fff_data = flipper_format_string_alloc(); */
4747

4848
instance->environment = subghz_environment_alloc();
49-
/*instance->is_database_loaded =
49+
instance->is_database_loaded =
5050
subghz_environment_load_keystore(instance->environment, SUBGHZ_KEYSTORE_DIR_NAME);
5151
subghz_environment_load_keystore(instance->environment, SUBGHZ_KEYSTORE_DIR_USER_NAME);
5252
subghz_environment_set_came_atomo_rainbow_table_file_name(
@@ -70,12 +70,15 @@ SubGhzTxRx* subghz_txrx_alloc() {
7070
instance->radio_device_type = SubGhzRadioDeviceTypeInternal;
7171
instance->radio_device_type =
7272
subghz_txrx_radio_device_set(instance, SubGhzRadioDeviceTypeExternalCC1101);
73-
*/
73+
74+
FURI_LOG_D(TAG, "completed TXRX alloc");
75+
7476
return instance;
7577
}
7678

7779
void subghz_txrx_free(SubGhzTxRx* instance) {
7880
furi_assert(instance);
81+
FURI_LOG_D(TAG, "freeing TXRX");
7982

8083
if(instance->radio_device_type != SubGhzRadioDeviceTypeInternal) {
8184
subghz_txrx_radio_device_power_off(instance);
@@ -85,7 +88,7 @@ void subghz_txrx_free(SubGhzTxRx* instance) {
8588
subghz_devices_deinit();
8689

8790
subghz_worker_free(instance->worker);
88-
//subghz_receiver_free(instance->receiver);
91+
subghz_receiver_free(instance->receiver);
8992
subghz_environment_free(instance->environment);
9093
/*flipper_format_free(instance->fff_data);*/
9194
furi_string_free(instance->preset->name);
@@ -162,6 +165,7 @@ static void subghz_txrx_begin(SubGhzTxRx* instance, uint8_t* preset_data) {
162165
subghz_devices_idle(instance->radio_device);
163166
subghz_devices_load_preset(instance->radio_device, FuriHalSubGhzPresetCustom, preset_data);
164167
instance->txrx_state = SubGhzTxRxStateIDLE;
168+
FURI_LOG_D(TAG, "completed subghz_txrx_begin");
165169
}
166170

167171
/*static uint32_t subghz_txrx_rx(SubGhzTxRx* instance, uint32_t frequency) {
@@ -190,6 +194,7 @@ static void subghz_txrx_idle(SubGhzTxRx* instance) {
190194
subghz_txrx_speaker_off(instance);
191195
instance->txrx_state = SubGhzTxRxStateIDLE;
192196
}
197+
FURI_LOG_D(TAG, "completed subghz_txrx_idle");
193198
}
194199

195200
/*static void subghz_txrx_rx_end(SubGhzTxRx* instance) {
@@ -223,6 +228,7 @@ static bool subghz_txrx_tx(SubGhzTxRx* instance, uint32_t frequency) {
223228
instance->txrx_state = SubGhzTxRxStateTx;
224229
}
225230

231+
FURI_LOG_D(TAG, "completed subghz_txrx_tx");
226232
return ret;
227233
}
228234

@@ -235,7 +241,8 @@ SubGhzTxRxStartTxState subghz_txrx_tx_start(SubGhzTxRx* instance, FlipperFormat*
235241
SubGhzTxRxStartTxState ret = SubGhzTxRxStartTxStateErrorParserOthers;
236242
FuriString* temp_str = furi_string_alloc();
237243
uint32_t repeat = 200;
238-
UNUSED(repeat);
244+
245+
FURI_LOG_D(TAG, "starting loop in subghz_txrx_tx_start");
239246
do {
240247
if(!flipper_format_rewind(flipper_format)) {
241248
FURI_LOG_E(TAG, "Rewind error");
@@ -419,10 +426,10 @@ void subghz_txrx_stop(SubGhzTxRx* instance) {
419426
return instance->hopper_state;
420427
}*/
421428

422-
/*void subghz_txrx_hopper_set_state(SubGhzTxRx* instance, SubGhzHopperState state) {
429+
void subghz_txrx_hopper_set_state(SubGhzTxRx* instance, SubGhzHopperState state) {
423430
furi_assert(instance);
424431
instance->hopper_state = state;
425-
}*/
432+
}
426433

427434
/*void subghz_txrx_hopper_unpause(SubGhzTxRx* instance) {
428435
furi_assert(instance);
@@ -479,10 +486,10 @@ void subghz_txrx_speaker_unmute(SubGhzTxRx* instance) {
479486
}
480487
}
481488

482-
/*void subghz_txrx_speaker_set_state(SubGhzTxRx* instance, SubGhzSpeakerState state) {
489+
void subghz_txrx_speaker_set_state(SubGhzTxRx* instance, SubGhzSpeakerState state) {
483490
furi_assert(instance);
484491
instance->speaker_state = state;
485-
}*/
492+
}
486493

487494
/*SubGhzSpeakerState subghz_txrx_speaker_get_state(SubGhzTxRx* instance) {
488495
furi_assert(instance);
@@ -548,7 +555,7 @@ void subghz_txrx_speaker_unmute(SubGhzTxRx* instance) {
548555
context);
549556
}*/
550557

551-
/*bool subghz_txrx_radio_device_is_external_connected(SubGhzTxRx* instance, const char* name) {
558+
bool subghz_txrx_radio_device_is_external_connected(SubGhzTxRx* instance, const char* name) {
552559
furi_assert(instance);
553560

554561
bool is_connect = false;
@@ -567,9 +574,9 @@ void subghz_txrx_speaker_unmute(SubGhzTxRx* instance) {
567574
subghz_txrx_radio_device_power_off(instance);
568575
}
569576
return is_connect;
570-
}*/
577+
}
571578

572-
/*SubGhzRadioDeviceType
579+
SubGhzRadioDeviceType
573580
subghz_txrx_radio_device_set(SubGhzTxRx* instance, SubGhzRadioDeviceType radio_device_type) {
574581
furi_assert(instance);
575582

@@ -589,7 +596,7 @@ void subghz_txrx_speaker_unmute(SubGhzTxRx* instance) {
589596
}
590597

591598
return instance->radio_device_type;
592-
}*/
599+
}
593600

594601
/*SubGhzRadioDeviceType subghz_txrx_radio_device_get(SubGhzTxRx* instance) {
595602
furi_assert(instance);

helpers/subghz/subghz_txrx.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void subghz_txrx_stop(SubGhzTxRx* instance);
137137
* @param instance Pointer to a SubGhzTxRx
138138
* @param state State hopper
139139
*/
140-
//void subghz_txrx_hopper_set_state(SubGhzTxRx* instance, SubGhzHopperState state);
140+
void subghz_txrx_hopper_set_state(SubGhzTxRx* instance, SubGhzHopperState state);
141141

142142
/**
143143
* Unpause hopper
@@ -187,7 +187,7 @@ void subghz_txrx_speaker_unmute(SubGhzTxRx* instance);
187187
* @param instance Pointer to a SubGhzTxRx
188188
* @param state State speaker
189189
*/
190-
//void subghz_txrx_speaker_set_state(SubGhzTxRx* instance, SubGhzSpeakerState state);
190+
void subghz_txrx_speaker_set_state(SubGhzTxRx* instance, SubGhzSpeakerState state);
191191

192192
/**
193193
* Get state speaker
@@ -296,16 +296,16 @@ void subghz_txrx_speaker_unmute(SubGhzTxRx* instance);
296296
* @param name Name of external radio device
297297
* @return bool True if is connected to the external radio device
298298
*/
299-
//bool subghz_txrx_radio_device_is_external_connected(SubGhzTxRx* instance, const char* name);
299+
bool subghz_txrx_radio_device_is_external_connected(SubGhzTxRx* instance, const char* name);
300300

301301
/* Set the selected radio device to use
302302
*
303303
* @param instance Pointer to a SubGhzTxRx
304304
* @param radio_device_type Radio device type
305305
* @return SubGhzRadioDeviceType Type of installed radio device
306306
*/
307-
/*SubGhzRadioDeviceType
308-
subghz_txrx_radio_device_set(SubGhzTxRx* instance, SubGhzRadioDeviceType radio_device_type);*/
307+
SubGhzRadioDeviceType
308+
subghz_txrx_radio_device_set(SubGhzTxRx* instance, SubGhzRadioDeviceType radio_device_type);
309309

310310
/* Get the selected radio device to use
311311
*

helpers/subghz/subghz_txrx_i.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ struct SubGhzTxRx {
66
SubGhzWorker* worker;
77

88
SubGhzEnvironment* environment;
9-
/*SubGhzReceiver* receiver;*/
9+
SubGhzReceiver* receiver;
1010
SubGhzTransmitter* transmitter;
1111
/*SubGhzProtocolDecoderBase* decoder_result;
1212
FlipperFormat* fff_data;
1313
*/
1414
SubGhzRadioPreset* preset;
1515
SubGhzSetting* setting;
1616

17-
/* uint8_t hopper_timeout;
17+
uint8_t hopper_timeout;
1818
uint8_t hopper_idx_frequency;
1919
bool is_database_loaded;
2020
SubGhzHopperState hopper_state;
21-
*/
21+
2222
SubGhzTxRxState txrx_state;
2323
SubGhzSpeakerState speaker_state;
2424
const SubGhzDevice* radio_device;

scenes/meal_pager_scene_transmit.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,19 @@ void meal_pager_scene_transmit_on_enter(void* context) {
1616
Meal_Pager* app = context;
1717
FURI_LOG_D(TAG, "Type is %lu", app->pager_type);
1818

19+
app->stop_transmit = false;
1920
meal_pager_blink_start_compile(app);
2021
meal_pager_transmit_model_set_type(app->meal_pager_transmit, app->pager_type);
2122
meal_pager_transmit_model_set_station(app->meal_pager_transmit, app->current_station);
2223
meal_pager_transmit_model_set_pager(app->meal_pager_transmit, app->current_pager);
2324
meal_pager_transmit_set_callback(app->meal_pager_transmit, meal_pager_transmit_callback, app);
2425
view_dispatcher_switch_to_view(app->view_dispatcher, Meal_PagerViewIdTransmit);
2526
meal_pager_retekess_t119_generate_all(app);
26-
27-
meal_pager_blink_start_subghz(app);
28-
app->stop_transmit = false;
2927
FURI_LOG_D(TAG, "Generated tmp.sub");
28+
meal_pager_blink_start_subghz(app);
29+
FURI_LOG_D(TAG, "Start Transmitting");
3030
subghz_send(app);
31+
FURI_LOG_D(TAG, "Finished Transmitting");
3132
meal_pager_blink_stop(app);
3233
}
3334

0 commit comments

Comments
 (0)