@@ -67,7 +67,7 @@ uint32_t Auav::init(uint16_t sample_rate_hz, //
6767 GPIO_TypeDef * baro_cs_port, uint16_t baro_cs_pin, // Baro CS
6868 SPI_HandleTypeDef * hspi)
6969{
70- // snprintf(name_, STATUS_NAME_MAX_LEN, "%s", "Auav ");
70+ snprintf (name_, STATUS_NAME_MAX_LEN, " %s" , " AuavPitotBaro " );
7171 initializationStatus_ = DRIVER_OK;
7272 sampleRateHz_ = sample_rate_hz;
7373
@@ -101,8 +101,8 @@ uint32_t Auav::init(uint16_t sample_rate_hz, //
101101
102102 rxFifo_[AUAV_PITOT].init (AUAV_FIFO_BUFFERS, sizeof (PressurePacket), auav_pitot_fifo_rx_buffer);
103103 char name[] = " Auav (pitot)" ;
104- memset (name_ [AUAV_PITOT], ' \0 ' , sizeof (name_ [AUAV_PITOT]));
105- strcpy (name_ [AUAV_PITOT], name);
104+ memset (name_local_ [AUAV_PITOT], ' \0 ' , sizeof (name_local_ [AUAV_PITOT]));
105+ strcpy (name_local_ [AUAV_PITOT], name);
106106 memset (cmdBytes_[AUAV_PITOT], 0 , AUAV_CMD_BYTES);
107107 cmdBytes_[AUAV_PITOT][0 ] = 0xAD ; // ~100 Hz
108108
@@ -128,8 +128,8 @@ uint32_t Auav::init(uint16_t sample_rate_hz, //
128128
129129 rxFifo_[AUAV_BARO].init (AUAV_FIFO_BUFFERS, sizeof (PressurePacket), auav_baro_fifo_rx_buffer);
130130 char name[] = " Auav (baro) " ;
131- memset (name_ [AUAV_BARO], ' \0 ' , sizeof (name_ [AUAV_BARO]));
132- strcpy (name_ [AUAV_BARO], name);
131+ memset (name_local_ [AUAV_BARO], ' \0 ' , sizeof (name_local_ [AUAV_BARO]));
132+ strcpy (name_local_ [AUAV_BARO], name);
133133 memset (cmdBytes_[AUAV_BARO], 0 , AUAV_CMD_BYTES);
134134 cmdBytes_[AUAV_BARO][0 ] = 0xAC ; // ~100 Hz
135135
@@ -184,13 +184,14 @@ uint32_t Auav::init(uint16_t sample_rate_hz, //
184184 uint8_t sensor_status = 0x00 ;
185185 HAL_StatusTypeDef hal_status = spi_[i].rx (&tx, &sensor_status, 1 , 200 );
186186 misc_printf (" HAL Status = 0x%04X : " , hal_status);
187- misc_printf (" %s Status = 0x%02X (0x%02X) - " , name_ [i], sensor_status, sensor_status_ready_[i]);
187+ misc_printf (" %s Status = 0x%02X (0x%02X) - " , name_local_ [i], sensor_status, sensor_status_ready_[i]);
188188
189189 if (sensor_status == sensor_status_ready_[i]) {
190190 misc_printf (" OK\n " );
191191 } else {
192192 misc_printf (" ERROR\n " );
193- initializationStatus_ |= DRIVER_SELF_DIAG_ERROR;
193+ if (i==AUAV_PITOT) initializationStatus_ |= AUAV_PITOT_ERROR; // DRIVER_SELF_DIAG_ERROR;
194+ else initializationStatus_ |= AUAV_BARO_ERROR; // DRIVER_SELF_DIAG_ERROR;
194195 }
195196 }
196197 for (int i = 0 ; i < 2 ; i++) {
@@ -395,26 +396,26 @@ bool Auav::display(void)
395396 PressurePacket p;
396397
397398 if (rxFifoReadMostRecent ((uint8_t *) &p, sizeof (p), AUAV_BARO)) {
398- misc_header (name_ [AUAV_BARO], p.drdy , p.header .timestamp , p.groupDelay );
399+ misc_header (name_local_ [AUAV_BARO], p.drdy , p.header .timestamp , p.groupDelay );
399400
400401 misc_f32 (99 , 101 , p.pressure / 1000 ., " Press" , " %6.2f" , " kPa" );
401- misc_f32 (19 , 40 , p.temperature - 273.15 , " Temp" , " %5.1f" , " C" );
402+ misc_f32 (18 , 50 , p.temperature - 273.15 , " Temp" , " %5.1f" , " C" );
402403 misc_x16 (sensorOk (AUAV_BARO), p.header .status , " Status" );
403404 misc_printf (" \n " );
404405 // return 1;
405406 } else {
406- misc_printf (" %s\n " , name_ [AUAV_BARO]);
407+ misc_printf (" %s\n " , name_local_ [AUAV_BARO]);
407408 }
408409
409410 if (rxFifoReadMostRecent ((uint8_t *) &p, sizeof (p), AUAV_PITOT)) {
410- misc_header (name_ [AUAV_PITOT], p.drdy , p.header .timestamp , p.groupDelay );
411- misc_f32 (2.5 , 2.5 , p.pressure , " Press" , " %6.2f" , " Pa" );
412- misc_f32 (19 , 40 , p.temperature - 273.15 , " Temp" , " %5.1f" , " C" );
411+ misc_header (name_local_ [AUAV_PITOT], p.drdy , p.header .timestamp , p.groupDelay );
412+ misc_f32 (- 5.0 , 5.0 , p.pressure , " Press" , " %6.2f" , " Pa" );
413+ misc_f32 (18 , 50 , p.temperature - 273.15 , " Temp" , " %5.1f" , " C" );
413414 misc_x16 (sensorOk (AUAV_PITOT), p.header .status , " Status" );
414415 misc_printf (" \n " );
415416 // return 1;
416417 } else {
417- misc_printf (" %s\n " , name_ [AUAV_PITOT]);
418+ misc_printf (" %s\n " , name_local_ [AUAV_PITOT]);
418419 }
419420
420421 return 0 ;
0 commit comments