forked from Archive/PX4-Autopilot
Refactored debug level into proper register, px4io status now correctly reads it. Added more of the missing alarms clear logic, alarms reporting now consistent. Adding missing sign change on mode switch, fixes override issue when attempting to switch to auto mode. Pending outdoor tests
This commit is contained in:
parent
5335de4cc7
commit
74bcf29c69
|
@ -213,7 +213,9 @@ controls_tick() {
|
||||||
if (assigned_channels == 0) {
|
if (assigned_channels == 0) {
|
||||||
rc_input_lost = true;
|
rc_input_lost = true;
|
||||||
} else {
|
} else {
|
||||||
|
/* set RC OK flag and clear RC lost alarm */
|
||||||
r_status_flags |= PX4IO_P_STATUS_FLAGS_RC_OK;
|
r_status_flags |= PX4IO_P_STATUS_FLAGS_RC_OK;
|
||||||
|
r_status_alarms &= ~PX4IO_P_STATUS_ALARMS_RC_LOST;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -274,7 +276,7 @@ controls_tick() {
|
||||||
* requested override.
|
* requested override.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ((r_status_flags & PX4IO_P_STATUS_FLAGS_RC_OK) && (r_rc_values[4] > RC_CHANNEL_HIGH_THRESH))
|
if ((r_status_flags & PX4IO_P_STATUS_FLAGS_RC_OK) && (REG_TO_SIGNED(r_rc_values[4]) > RC_CHANNEL_HIGH_THRESH))
|
||||||
override = true;
|
override = true;
|
||||||
|
|
||||||
if (override) {
|
if (override) {
|
||||||
|
|
|
@ -64,8 +64,7 @@ struct sys_state_s system_state;
|
||||||
|
|
||||||
static struct hrt_call serial_dma_call;
|
static struct hrt_call serial_dma_call;
|
||||||
|
|
||||||
/* global debug level for isr_debug() */
|
/* store i2c reset count XXX this should be a register, together with other error counters */
|
||||||
volatile uint8_t debug_level = 0;
|
|
||||||
volatile uint32_t i2c_loop_resets = 0;
|
volatile uint32_t i2c_loop_resets = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -90,7 +89,7 @@ static char msg[NUM_MSG][40];
|
||||||
void
|
void
|
||||||
isr_debug(uint8_t level, const char *fmt, ...)
|
isr_debug(uint8_t level, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
if (level > debug_level) {
|
if (level > r_page_setup[PX4IO_P_SETUP_SET_DEBUG]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -219,7 +218,7 @@ user_start(int argc, char *argv[])
|
||||||
struct mallinfo minfo = mallinfo();
|
struct mallinfo minfo = mallinfo();
|
||||||
|
|
||||||
isr_debug(1, "d:%u s=0x%x a=0x%x f=0x%x r=%u m=%u",
|
isr_debug(1, "d:%u s=0x%x a=0x%x f=0x%x r=%u m=%u",
|
||||||
(unsigned)debug_level,
|
(unsigned)r_page_setup[PX4IO_P_SETUP_SET_DEBUG],
|
||||||
(unsigned)r_status_flags,
|
(unsigned)r_status_flags,
|
||||||
(unsigned)r_setup_arming,
|
(unsigned)r_setup_arming,
|
||||||
(unsigned)r_setup_features,
|
(unsigned)r_setup_features,
|
||||||
|
|
|
@ -137,7 +137,8 @@ volatile uint16_t r_page_setup[] =
|
||||||
[PX4IO_P_SETUP_RELAYS] = 0,
|
[PX4IO_P_SETUP_RELAYS] = 0,
|
||||||
[PX4IO_P_SETUP_VBATT_SCALE] = 10000,
|
[PX4IO_P_SETUP_VBATT_SCALE] = 10000,
|
||||||
[PX4IO_P_SETUP_IBATT_SCALE] = 0,
|
[PX4IO_P_SETUP_IBATT_SCALE] = 0,
|
||||||
[PX4IO_P_SETUP_IBATT_BIAS] = 0
|
[PX4IO_P_SETUP_IBATT_BIAS] = 0,
|
||||||
|
[PX4IO_P_SETUP_SET_DEBUG] = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PX4IO_P_SETUP_FEATURES_VALID (0)
|
#define PX4IO_P_SETUP_FEATURES_VALID (0)
|
||||||
|
@ -201,6 +202,7 @@ registers_set(uint8_t page, uint8_t offset, const uint16_t *values, unsigned num
|
||||||
|
|
||||||
system_state.fmu_data_received_time = hrt_absolute_time();
|
system_state.fmu_data_received_time = hrt_absolute_time();
|
||||||
r_status_flags |= PX4IO_P_STATUS_FLAGS_FMU_OK;
|
r_status_flags |= PX4IO_P_STATUS_FLAGS_FMU_OK;
|
||||||
|
r_status_alarms &= ~PX4IO_P_STATUS_ALARMS_FMU_LOST;
|
||||||
r_status_flags &= ~PX4IO_P_STATUS_FLAGS_RAW_PWM;
|
r_status_flags &= ~PX4IO_P_STATUS_FLAGS_RAW_PWM;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -351,8 +353,8 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PX4IO_P_SETUP_SET_DEBUG:
|
case PX4IO_P_SETUP_SET_DEBUG:
|
||||||
debug_level = value;
|
r_page_setup[PX4IO_P_SETUP_SET_DEBUG] = value;
|
||||||
isr_debug(0, "set debug %u\n", (unsigned)debug_level);
|
isr_debug(0, "set debug %u\n", (unsigned)r_page_setup[PX4IO_P_SETUP_SET_DEBUG]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue