Skip to content

Commit

Permalink
Disable debug timer sampling mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Jan 11, 2023
1 parent e84beb0 commit 65d7c70
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ ProtoViewApp* protoview_app_alloc() {

/* Setup rx worker and environment. */
app->txrx->freq_mod_changed = false;
app->txrx->debug_direct_sampling = false;
app->txrx->debug_timer_sampling = false;
app->txrx->last_g0_change_time = DWT->CYCCNT;
app->txrx->last_g0_value = false;
app->txrx->worker = subghz_worker_alloc();
Expand Down Expand Up @@ -181,7 +181,7 @@ void protoview_app_free(ProtoViewApp *app) {
subghz_setting_free(app->setting);

// Worker stuff.
if (!app->txrx->debug_direct_sampling) {
if (!app->txrx->debug_timer_sampling) {
subghz_receiver_free(app->txrx->receiver);
subghz_environment_free(app->txrx->environment);
subghz_worker_free(app->txrx->worker);
Expand Down
6 changes: 2 additions & 4 deletions app.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ struct ProtoViewTxRx {
SubGhzReceiver* receiver;
TxRxState txrx_state; /* Receiving, idle or sleeping? */

/* Direct sampling mode state. */
bool debug_direct_sampling; /* Read data from GDO0 in a busy loop. Only
/* Timer sampling mode state. */
bool debug_timer_sampling; /* Read data from GDO0 in a busy loop. Only
for testing. */
FuriThread *ds_thread; /* Direct sampling thread. */
bool ds_thread_running; /* Exit condition for the thread. */
uint32_t last_g0_change_time; /* Last high->low (or reverse) switch. */
bool last_g0_value; /* Current value (high or low): we are
checking the duration in the timer
Expand Down
4 changes: 2 additions & 2 deletions app_subghz.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ uint32_t radio_rx(ProtoViewApp* app) {
furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
furi_hal_subghz_flush_rx();
furi_hal_subghz_rx();
if (!app->txrx->debug_direct_sampling) {
if (!app->txrx->debug_timer_sampling) {

furi_hal_subghz_start_async_rx(subghz_worker_rx_callback,
app->txrx->worker);
Expand All @@ -76,7 +76,7 @@ uint32_t radio_rx(ProtoViewApp* app) {
void radio_rx_end(ProtoViewApp* app) {
furi_assert(app);
if (app->txrx->txrx_state == TxRxStateRx) {
if (!app->txrx->debug_direct_sampling) {
if (!app->txrx->debug_timer_sampling) {
if(subghz_worker_is_running(app->txrx->worker)) {
subghz_worker_stop(app->txrx->worker);
furi_hal_subghz_stop_async_rx();
Expand Down
4 changes: 2 additions & 2 deletions view_direct_sampling.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void process_input_direct_sampling(ProtoViewApp *app, InputEvent input) {
* the CC1101 data directly. */
void view_enter_direct_sampling(ProtoViewApp *app) {
if (app->txrx->txrx_state == TxRxStateRx &&
!app->txrx->debug_direct_sampling)
!app->txrx->debug_timer_sampling)
{
subghz_worker_stop(app->txrx->worker);
} else {
Expand All @@ -45,7 +45,7 @@ void view_enter_direct_sampling(ProtoViewApp *app) {
/* Exit view. Restore the subghz thread. */
void view_exit_direct_sampling(ProtoViewApp *app) {
if (app->txrx->txrx_state == TxRxStateRx &&
!app->txrx->debug_direct_sampling)
!app->txrx->debug_timer_sampling)
{
subghz_worker_start(app->txrx->worker);
} else {
Expand Down
11 changes: 6 additions & 5 deletions view_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ void render_view_settings(Canvas *const canvas, ProtoViewApp *app) {
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas,10,61,"Use up and down to modify");

if (app->txrx->debug_direct_sampling)
canvas_draw_str(canvas,3,52,"(DEBUG direct sampling is ON)");
if (app->txrx->debug_timer_sampling)
canvas_draw_str(canvas,3,52,"(DEBUG timer sampling is ON)");

/* Show frequency. We can use big numbers font since it's just a number. */
if (app->current_view == ViewFrequencySettings) {
Expand All @@ -43,15 +43,16 @@ void process_input_settings(ProtoViewApp *app, InputEvent input) {
* modulation. */
app->frequency = subghz_setting_get_default_frequency(app->setting);
app->modulation = 0;
} else if (input.type == InputTypeLong && input.key == InputKeyDown) {
} else if (0 && input.type == InputTypeLong && input.key == InputKeyDown) {
/* Long pressing to down switches between normal and debug
* direct sampling mode. */
* timer sampling mode. NOTE: this feature is disabled for users,
* only useful for devs (if useful at all). */

/* We have to stop the previous sampling system. */
radio_rx_end(app);

/* Then switch mode and start the new one. */
app->txrx->debug_direct_sampling = !app->txrx->debug_direct_sampling;
app->txrx->debug_timer_sampling = !app->txrx->debug_timer_sampling;
radio_begin(app);
radio_rx(app);
} else if (input.type == InputTypePress &&
Expand Down

0 comments on commit 65d7c70

Please sign in to comment.