Browse Source

fix adc triggers frame format broken

Ondřej Hruška 1 year ago
parent
commit
49c291dade
Signed by: Ondřej Hruška <ondra@ondrovo.com> GPG key ID: 2C5FD5035250423D
1 changed files with 3 additions and 5 deletions
  1. 3 5
      units/adc/_adc_core.c

+ 3 - 5
units/adc/_adc_core.c View File

@@ -4,7 +4,6 @@
4 4
 // The core functionality of the ADC unit is defined here.
5 5
 //
6 6
 
7
-#include <stm32f072xb.h>
8 7
 #include "platform.h"
9 8
 #include "unit_base.h"
10 9
 #include "unit_adc.h"
@@ -72,7 +71,7 @@ static void UADC_JobSendTriggerCaptureHeader(Job *job)
72 71
         .unit = unit,
73 72
         .type = EVT_CAPT_START,
74 73
         .timestamp = job->timestamp,
75
-        .length = (priv->pretrig_len + 1) * // see below why +1
74
+        .length = (priv->pretrig_len + ((priv->pretrig_len > 0)?1:0)) * // see below why +1
76 75
                       priv->nb_channels *
77 76
                       sizeof(uint16_t) +
78 77
                   4 /*pretrig len*/ +
@@ -87,8 +86,8 @@ static void UADC_JobSendTriggerCaptureHeader(Job *job)
87 86
     priv->stream_frame_id = er.sent_msg_id;
88 87
     {
89 88
         // preamble
90
-        uint8_t buf[4];
91
-        PayloadBuilder pb = pb_start(buf, 4, NULL);
89
+        uint8_t buf[6];
90
+        PayloadBuilder pb = pb_start(buf, 6, NULL);
92 91
         pb_u32(&pb, priv->pretrig_len);
93 92
         pb_u8(&pb, edge);
94 93
         pb_u8(&pb, priv->stream_serial++); // This is the serial counter for the first chunk
@@ -371,7 +370,6 @@ void UADC_ADC_EOS_Handler(void *arg)
371 370
     sample_pos -= priv->nb_channels;
372 371
 
373 372
     uint16_t val;
374
-    // TODO change this to a pre-computed byte array traversal
375 373
 
376 374
 #if 1
377 375
     for (uint32_t j = 0; j < priv->nb_channels; j++) {