mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
[sys_time] cleanup: use sys_time.nb_x instead of old cpu_time_x
This commit is contained in:
@@ -58,7 +58,7 @@ void baro_init(void) {
|
||||
}
|
||||
|
||||
void baro_periodic(void) {
|
||||
if (cpu_time_sec > 1) {
|
||||
if (sys_time.nb_sec > 1) {
|
||||
if (ms5611_status == MS5611_IDLE) {
|
||||
/* start D1 conversion */
|
||||
ms5611_status = MS5611_CONV_D1;
|
||||
|
||||
@@ -81,7 +81,7 @@ void baro_init(void) {
|
||||
}
|
||||
|
||||
void baro_periodic(void) {
|
||||
if (cpu_time_sec > 1) {
|
||||
if (sys_time.nb_sec > 1) {
|
||||
if (ms5611_status == MS5611_IDLE) {
|
||||
/* start D1 conversion */
|
||||
ms5611_status = MS5611_CONV_D1;
|
||||
|
||||
@@ -76,7 +76,7 @@ static inline void main_periodic_task( void ) {
|
||||
// uint16_t foo = ami601_status;
|
||||
// DOWNLINK_SEND_BOOT(&foo);
|
||||
//#endif
|
||||
// if (cpu_time_sec > 2)
|
||||
// if (sys_time.nb_sec > 2)
|
||||
|
||||
imu_periodic();
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ static inline void main_init( void ) {
|
||||
static inline void main_periodic_task( void ) {
|
||||
LED_TOGGLE(1);
|
||||
Uart0PrintString("demo3 running since ");
|
||||
Uart0PrintHex32(cpu_time_sec);
|
||||
Uart0PrintHex32(sys_time.nb_sec);
|
||||
Uart0PrintString(" seconds\n");
|
||||
}
|
||||
|
||||
@@ -60,9 +60,6 @@ struct sys_time {
|
||||
|
||||
extern struct sys_time sys_time;
|
||||
|
||||
//FIXME temporary hack
|
||||
#define cpu_time_sec sys_time.nb_sec
|
||||
#define cpu_time_ticks sys_time.nb_sec_rem
|
||||
|
||||
extern void sys_time_init(void);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ void dust_gp2y_periodic( void ) {
|
||||
if (dust_gp2y_status == DUST_GP2Y_IDLE) {
|
||||
I2CReceive(GP2Y_I2C_DEV, gp2y_trans, GP2Y_SLAVE_ADDR, 2);
|
||||
}
|
||||
else if (dust_gp2y_status == DUST_GP2Y_UNINIT && cpu_time_sec > 1) {
|
||||
else if (dust_gp2y_status == DUST_GP2Y_UNINIT && sys_time.nb_sec > 1) {
|
||||
dust_gp2y_status = DUST_GP2Y_IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void humid_htm_init(void) {
|
||||
}
|
||||
|
||||
void humid_htm_start( void ) {
|
||||
if (cpu_time_sec > 1) {
|
||||
if (sys_time.nb_sec > 1) {
|
||||
/* measurement request: wake up sensor, sample temperature/humidity */
|
||||
I2CTransmit(HTM_I2C_DEV, htm_trans, HTM_SLAVE_ADDR, 0);
|
||||
htm_status = HTM_MR;
|
||||
|
||||
@@ -67,7 +67,7 @@ void ir_mlx_init( void ) {
|
||||
}
|
||||
|
||||
void ir_mlx_periodic( void ) {
|
||||
if (cpu_time_sec > 1) {
|
||||
if (sys_time.nb_sec > 1) {
|
||||
if (ir_mlx_status >= IR_MLX_IDLE) {
|
||||
/* start two byte case temperature */
|
||||
mlx_trans.buf[0] = MLX90614_TA;
|
||||
|
||||
@@ -88,7 +88,7 @@ void baro_ms5611_init(void) {
|
||||
}
|
||||
|
||||
void baro_ms5611_periodic( void ) {
|
||||
if (cpu_time_sec > 1) {
|
||||
if (sys_time.nb_sec > 1) {
|
||||
if (ms5611_status >= MS5611_IDLE) {
|
||||
/* start D1 conversion */
|
||||
ms5611_status = MS5611_CONV_D1;
|
||||
@@ -114,7 +114,7 @@ void baro_ms5611_periodic( void ) {
|
||||
}
|
||||
|
||||
void baro_ms5611_d1( void ) {
|
||||
if (cpu_time_sec > 1) {
|
||||
if (sys_time.nb_sec > 1) {
|
||||
if (ms5611_status == MS5611_CONV_D1_OK) {
|
||||
/* read D1 adc */
|
||||
ms5611_status = MS5611_ADC_D1;
|
||||
@@ -125,7 +125,7 @@ void baro_ms5611_d1( void ) {
|
||||
}
|
||||
|
||||
void baro_ms5611_d2( void ) {
|
||||
if (cpu_time_sec > 1) {
|
||||
if (sys_time.nb_sec > 1) {
|
||||
if (ms5611_status == MS5611_CONV_D2_OK) {
|
||||
/* read D2 adc */
|
||||
ms5611_status = MS5611_ADC_D2;
|
||||
|
||||
@@ -34,7 +34,7 @@ static void EXTINT_ISR(void) __attribute__((naked));
|
||||
static void SPI1_ISR(void) __attribute__((naked));
|
||||
|
||||
void baro_scp_periodic(void) {
|
||||
if (baro_scp_status == STA_UNINIT && cpu_time_sec > 1) {
|
||||
if (baro_scp_status == STA_UNINIT && sys_time.nb_sec > 1) {
|
||||
baro_scp_start_high_res_measurement();
|
||||
baro_scp_status = STA_INITIALISING;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ void baro_scp_init( void ) {
|
||||
|
||||
void baro_scp_periodic( void ) {
|
||||
|
||||
if (baro_scp_status == BARO_SCP_UNINIT && cpu_time_sec > 1) {
|
||||
if (baro_scp_status == BARO_SCP_UNINIT && sys_time.nb_sec > 1) {
|
||||
|
||||
baro_scp_start_high_res_measurement();
|
||||
baro_scp_status = BARO_SCP_IDLE;
|
||||
|
||||
@@ -81,7 +81,7 @@ struct GpsState {
|
||||
uint8_t nb_channels; ///< Number of scanned satellites
|
||||
struct SVinfo svinfos[GPS_NB_CHANNELS]; ///< holds information from the Space Vehicles (Satellites)
|
||||
|
||||
uint32_t last_fix_ticks; ///< cpu time in ticks at last valid fix
|
||||
uint32_t last_fix_ticks; ///< cpu time ticks at last valid fix
|
||||
uint32_t last_fix_time; ///< cpu time in sec at last valid fix
|
||||
uint16_t reset; ///< hotstart, warmstart, coldstart
|
||||
};
|
||||
|
||||
@@ -69,7 +69,7 @@ extern struct GpsNmea gps_nmea;
|
||||
nmea_parse_msg(); \
|
||||
if (gps_nmea.pos_available) { \
|
||||
if (gps.fix == GPS_FIX_3D) { \
|
||||
gps.last_fix_ticks = cpu_time_ticks; \
|
||||
gps.last_fix_ticks = sys_time.nb_sec_rem; \
|
||||
gps.last_fix_time = sys_time.nb_sec; \
|
||||
} \
|
||||
_sol_available_callback(); \
|
||||
|
||||
@@ -71,7 +71,7 @@ static inline void main_init( void ) {
|
||||
|
||||
static inline void main_periodic_task( void ) {
|
||||
|
||||
if (cpu_time_sec > 1) imu_periodic();
|
||||
if (sys_time.nb_sec > 1) imu_periodic();
|
||||
RunOnceEvery(10, { LED_PERIODIC();});
|
||||
main_report();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user