mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 15:30:08 +08:00
remove crappy code, hw is fixed :)
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "subsystems/sensors/baro.h"
|
||||
#include "led.h"
|
||||
#include "mcu_periph/spi.h"
|
||||
|
||||
/* Common Baro struct */
|
||||
struct Baro baro;
|
||||
@@ -37,6 +38,7 @@ uint16_t startup_cnt;
|
||||
|
||||
void baro_init( void ) {
|
||||
mcp355x_init();
|
||||
SpiSelectSlave0(); // never unselect this slave (continious conversion mode)
|
||||
baro.status = BS_UNINITIALIZED;
|
||||
baro.absolute = 0;
|
||||
baro.differential = 0; /* not handled on this board */
|
||||
@@ -46,24 +48,10 @@ void baro_init( void ) {
|
||||
startup_cnt = STARTUP_COUNTER;
|
||||
}
|
||||
|
||||
// Need to play with slave select
|
||||
#include "mcu_periph/spi.h"
|
||||
|
||||
void baro_periodic( void ) {
|
||||
|
||||
if (baro.status == BS_UNINITIALIZED) {
|
||||
/**
|
||||
* Crappy code to empty the buffer
|
||||
* then unselect the device (goes to shutdown ?)
|
||||
* reselect to go to continious conversion mode
|
||||
* make some readings before setting BS_RUNNING
|
||||
* don't unselect the slave !
|
||||
*/
|
||||
if (startup_cnt == 150) { SpiSelectSlave0(); mcp355x_read(); }
|
||||
else if (startup_cnt == 149) { SpiUnselectSlave0(); }
|
||||
else if (startup_cnt == 100) { SpiSelectSlave0(); }
|
||||
else if (startup_cnt < 90) { RunOnceEvery(4, mcp355x_read()); }
|
||||
// decrease init counter
|
||||
// Run some loops to get correct readings from the adc
|
||||
--startup_cnt;
|
||||
#ifdef ROTORCRAFT_BARO_LED
|
||||
LED_TOGGLE(ROTORCRAFT_BARO_LED);
|
||||
@@ -76,6 +64,6 @@ void baro_periodic( void ) {
|
||||
}
|
||||
}
|
||||
// Read the ADC (at 50/4 Hz, conversion time is 68 ms)
|
||||
else { RunOnceEvery(4,mcp355x_read()); }
|
||||
RunOnceEvery(4,mcp355x_read());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user