Просмотр исходного кода

Suppress charging to improve RF performances.

antirez 3 лет назад
Родитель
Сommit
2bf380d0f5
2 измененных файлов с 6 добавлено и 6 удалено
  1. 1 1
      app.c
  2. 5 5
      app_subghz.c

+ 1 - 1
app.c

@@ -182,7 +182,7 @@ ProtoViewApp* protoview_app_alloc() {
 void protoview_app_free(ProtoViewApp *app) {
 void protoview_app_free(ProtoViewApp *app) {
     furi_assert(app);
     furi_assert(app);
 
 
-    // Put CC1101 on sleep.
+    // Put CC1101 on sleep, this also restores charging.
     radio_sleep(app);
     radio_sleep(app);
 
 
     // View related.
     // View related.

+ 5 - 5
app_subghz.c

@@ -37,6 +37,10 @@ void radio_begin(ProtoViewApp* app) {
     furi_hal_subghz_reset();
     furi_hal_subghz_reset();
     furi_hal_subghz_idle();
     furi_hal_subghz_idle();
 
 
+    /* Power circuits are noisy. Suppressing the charge while we use
+     * ProtoView will improve the RF performances. */
+    furi_hal_power_suppress_charge_enter();
+
     /* The CC1101 preset can be either one of the standard presets, if
     /* The CC1101 preset can be either one of the standard presets, if
      * the modulation "custom" field is NULL, or a custom preset we
      * the modulation "custom" field is NULL, or a custom preset we
      * defined in custom_presets.h. */
      * defined in custom_presets.h. */
@@ -105,7 +109,7 @@ void radio_sleep(ProtoViewApp* app) {
     }
     }
     furi_hal_subghz_sleep();
     furi_hal_subghz_sleep();
     app->txrx->txrx_state = TxRxStateSleep;
     app->txrx->txrx_state = TxRxStateSleep;
-
+    furi_hal_power_suppress_charge_exit();
 }
 }
 
 
 /* =============================== Transmission ============================= */
 /* =============================== Transmission ============================= */
@@ -117,8 +121,6 @@ void radio_tx_signal(ProtoViewApp *app, FuriHalSubGhzAsyncTxCallback data_feeder
     TxRxState oldstate = app->txrx->txrx_state;
     TxRxState oldstate = app->txrx->txrx_state;
 
 
     if (oldstate == TxRxStateRx) radio_rx_end(app);
     if (oldstate == TxRxStateRx) radio_rx_end(app);
-//    furi_hal_power_suppress_charge_enter();
-
     radio_begin(app);
     radio_begin(app);
 
 
     furi_hal_subghz_idle();
     furi_hal_subghz_idle();
@@ -132,8 +134,6 @@ void radio_tx_signal(ProtoViewApp *app, FuriHalSubGhzAsyncTxCallback data_feeder
     furi_hal_subghz_stop_async_tx();
     furi_hal_subghz_stop_async_tx();
     furi_hal_subghz_idle();
     furi_hal_subghz_idle();
 
 
-//    furi_hal_power_suppress_charge_exit();
-
     radio_begin(app);
     radio_begin(app);
     if (oldstate == TxRxStateRx) radio_rx(app);
     if (oldstate == TxRxStateRx) radio_rx(app);
 }
 }