Allow gyro-less booting

This commit is contained in:
jflyper 2017-06-30 08:51:06 +09:00
parent b9f533abe3
commit adee15a806
5 changed files with 15 additions and 5 deletions

View File

@ -2711,7 +2711,7 @@ static void cliStatus(char *cmdline)
const int systemRate = getTaskDeltaTime(TASK_SYSTEM) == 0 ? 0 : (int)(1000000.0f / ((float)getTaskDeltaTime(TASK_SYSTEM))); const int systemRate = getTaskDeltaTime(TASK_SYSTEM) == 0 ? 0 : (int)(1000000.0f / ((float)getTaskDeltaTime(TASK_SYSTEM)));
cliPrintLinef("CPU:%d%%, cycle time: %d, GYRO rate: %d, RX rate: %d, System rate: %d", cliPrintLinef("CPU:%d%%, cycle time: %d, GYRO rate: %d, RX rate: %d, System rate: %d",
constrain(averageSystemLoadPercent, 0, 100), getTaskDeltaTime(TASK_GYROPID), gyroRate, rxRate, systemRate); constrain(averageSystemLoadPercent, 0, 100), getTaskDeltaTime(TASK_GYROPID), gyroRate, rxRate, systemRate);
cliPrintLinef("Arming disable flags: 0x%x", getArmingDisableFlags() & ~ARMING_DISABLED_CLI);
} }
#ifndef SKIP_TASK_STATISTICS #ifndef SKIP_TASK_STATISTICS

View File

@ -478,8 +478,8 @@ void init(void)
initBoardAlignment(boardAlignment()); initBoardAlignment(boardAlignment());
if (!sensorsAutodetect()) { if (!sensorsAutodetect()) {
// if gyro was not detected due to whatever reason, we give up now. // if gyro was not detected due to whatever reason, don't arm.
failureMode(FAILURE_MISSING_ACC); setArmingDisabled(ARMING_DISABLED_NO_GYRO);
} }
systemState |= SYSTEM_STATE_SENSORS_READY; systemState |= SYSTEM_STATE_SENSORS_READY;

View File

@ -259,8 +259,11 @@ void osdSlaveTasksInit(void)
void fcTasksInit(void) void fcTasksInit(void)
{ {
schedulerInit(); schedulerInit();
rescheduleTask(TASK_GYROPID, gyro.targetLooptime);
setTaskEnabled(TASK_GYROPID, true); if (sensors(SENSOR_GYRO)) {
rescheduleTask(TASK_GYROPID, gyro.targetLooptime);
setTaskEnabled(TASK_GYROPID, true);
}
if (sensors(SENSOR_ACC)) { if (sensors(SENSOR_ACC)) {
setTaskEnabled(TASK_ACCEL, true); setTaskEnabled(TASK_ACCEL, true);

View File

@ -46,6 +46,11 @@ bool isArmingDisabled()
return armingDisableFlags; return armingDisableFlags;
} }
armingDisableFlags_e getArmingDisableFlags(void)
{
return armingDisableFlags;
}
/** /**
* Enables the given flight mode. A beep is sounded if the flight mode * Enables the given flight mode. A beep is sounded if the flight mode
* has changed. Returns the new 'flightModeFlags' value. * has changed. Returns the new 'flightModeFlags' value.

View File

@ -40,11 +40,13 @@ typedef enum {
ARMING_DISABLED_CMS_MENU = (1 << 7), ARMING_DISABLED_CMS_MENU = (1 << 7),
ARMING_DISABLED_OSD_MENU = (1 << 8), ARMING_DISABLED_OSD_MENU = (1 << 8),
ARMING_DISABLED_BST = (1 << 9), ARMING_DISABLED_BST = (1 << 9),
ARMING_DISABLED_NO_GYRO = (1 << 10),
} armingDisableFlags_e; } armingDisableFlags_e;
void setArmingDisabled(armingDisableFlags_e flag); void setArmingDisabled(armingDisableFlags_e flag);
void unsetArmingDisabled(armingDisableFlags_e flag); void unsetArmingDisabled(armingDisableFlags_e flag);
bool isArmingDisabled(void); bool isArmingDisabled(void);
armingDisableFlags_e getArmingDisableFlags(void);
typedef enum { typedef enum {
ANGLE_MODE = (1 << 0), ANGLE_MODE = (1 << 0),