Преглед на файлове

Third TPMS custom preset. Start with subghz feeding.

antirez преди 3 години
родител
ревизия
0d62d893d6
променени са 6 файла, в които са добавени 48 реда и са изтрити 4 реда
  1. 1 1
      app.c
  2. 1 0
      app_subghz.c
  3. 43 0
      custom_presets.h
  4. 1 1
      signal.c
  5. 1 1
      view_direct_sampling.c
  6. 1 1
      view_settings.c

+ 1 - 1
app.c

@@ -130,7 +130,7 @@ ProtoViewApp* protoview_app_alloc() {
 
     /* Setup rx worker and environment. */
     app->txrx->freq_mod_changed = false;
-    app->txrx->debug_direct_sampling = true;
+    app->txrx->debug_direct_sampling = false;
     app->txrx->last_g0_change_time = DWT->CYCCNT;
     app->txrx->last_g0_value = false;
     app->txrx->worker = subghz_worker_alloc();

+ 1 - 0
app_subghz.c

@@ -21,6 +21,7 @@ ProtoViewModulation ProtoViewModulations[] = {
     {"GFSK", FuriHalSubGhzPresetGFSK9_99KbAsync, NULL},
     {"TPMS 1 (FSK)", 0, (uint8_t*)protoview_subghz_tpms1_async_regs},
     {"TPMS 2 (FSK)", 0, (uint8_t*)protoview_subghz_tpms2_async_regs},
+    {"TPMS 3 (FSK)", 0, (uint8_t*)protoview_subghz_tpms3_async_regs},
     {NULL, 0, NULL} /* End of list sentinel. */
 };
 

+ 43 - 0
custom_presets.h

@@ -130,3 +130,46 @@ static uint8_t protoview_subghz_tpms2_async_regs[][2] = {
     {0, 0},
 };
 
+/* Parameters that should work well for the TPMS PVM C210 sensor. */
+static uint8_t protoview_subghz_tpms3_async_regs[][2] = {
+    /* GPIO GD0 */
+    {CC1101_IOCFG0, 0x0D}, // GD0 as async serial data output/input
+
+    /* Frequency Synthesizer Control */
+    {CC1101_FSCTRL1, 0x06}, // IF = (26*10^6) / (2^10) * 0x06 = 152343.75Hz
+
+    /* Packet engine */
+    {CC1101_PKTCTRL0, 0x32}, // Async, continious, no whitening
+    {CC1101_PKTCTRL1, 0x04},
+
+    // // Modem Configuration
+    {CC1101_MDMCFG0, 0x00},
+    {CC1101_MDMCFG1, 0x02}, // 2 is the channel spacing exponet: not used
+    {CC1101_MDMCFG2, 0x10}, // GFSK without any other check
+    {CC1101_MDMCFG3, 0x93}, // Data rate is 20kBaud
+    {CC1101_MDMCFG4, 0x59}, // Rx bandwidth filter is 325 kHz
+    {CC1101_DEVIATN, 0x40}, // Deviation 25.39 Khz
+
+    /* Main Radio Control State Machine */
+    {CC1101_MCSM0, 0x18}, // Autocalibrate on idle-to-rx/tx, PO_TIMEOUT is 64 cycles(149-155us)
+
+    /* Frequency Offset Compensation Configuration */
+    {CC1101_FOCCFG,
+     0x16}, // no frequency offset compensation, POST_K same as PRE_K, PRE_K is 4K, GATE is off
+
+    /* Automatic Gain Control */
+    {CC1101_AGCCTRL0, 0x80},
+    {CC1101_AGCCTRL1, 0x58},
+    {CC1101_AGCCTRL2, 0x87},
+
+    /* Wake on radio and timeouts control */
+    {CC1101_WORCTRL, 0xFB}, // WOR_RES is 2^15 periods (0.91 - 0.94 s) 16.5 - 17.2 hours
+
+    /* Frontend configuration */
+    {CC1101_FREND0, 0x10}, // Adjusts current TX LO buffer
+    {CC1101_FREND1, 0x56},
+
+    /* End  */
+    {0, 0},
+};
+

+ 1 - 1
signal.c

@@ -71,7 +71,7 @@ uint32_t search_coherent_signal(RawSamplesBuffer *s, uint32_t idx) {
                 /* Is the difference in duration between this signal and
                  * the class we are inspecting less than a given percentage?
                  * If so, accept this signal. */
-                if (delta < classavg/8) { /* 100%/8 = 12%. */
+                if (delta < classavg/6) { /* 100%/6 = 16%. */
                     /* It is useful to compute the average of the class
                      * we are observing. We know how many samples we got so
                      * far, so we can recompute the average easily.

+ 1 - 1
view_direct_sampling.c

@@ -20,7 +20,7 @@ void render_view_direct_sampling(Canvas *const canvas, ProtoViewApp *app) {
         }
     }
     canvas_set_font(canvas, FontSecondary);
-    canvas_draw_str_with_border(canvas,40,60,"Direct sampling",
+    canvas_draw_str_with_border(canvas,36,60,"Direct sampling",
         ColorWhite,ColorBlack);
 }
 

+ 1 - 1
view_settings.c

@@ -21,7 +21,7 @@ void render_view_settings(Canvas *const canvas, ProtoViewApp *app) {
     canvas_draw_str(canvas,10,61,"Use up and down to modify");
 
     if (app->txrx->debug_direct_sampling)
-        canvas_draw_str(canvas,3,54,"(DEBUG direct sampling is ON)");
+        canvas_draw_str(canvas,3,52,"(DEBUG direct sampling is ON)");
 
     /* Show frequency. We can use big numbers font since it's just a number. */
     if (app->current_view == ViewFrequencySettings) {