1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

fixed enabled and disabled messages for logging in all cases

This commit is contained in:
Corvus Corax 2013-12-01 00:03:24 +01:00
parent 25fd3d5740
commit 9c6abef89b

View File

@ -91,23 +91,29 @@ static void StatusUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
static void FlightStatusUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) static void FlightStatusUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
{ {
FlightStatusGet(&flightstatus); FlightStatusGet(&flightstatus);
switch (settings.LoggingEnabled) { if (settings.LoggingEnabled == DEBUGLOGSETTINGS_LOGGINGENABLED_ONLYWHENARMED) {
case DEBUGLOGSETTINGS_LOGGINGENABLED_ALWAYS: if (flightstatus.Armed != FLIGHTSTATUS_ARMED_ARMED) {
PIOS_DEBUGLOG_Enable(1); PIOS_DEBUGLOG_Printf("FlightStatus Disarmed: On board Logging disabled.");
break; PIOS_DEBUGLOG_Enable(0);
case DEBUGLOGSETTINGS_LOGGINGENABLED_ONLYWHENARMED: } else {
PIOS_DEBUGLOG_Enable(flightstatus.Armed == FLIGHTSTATUS_ARMED_ARMED); PIOS_DEBUGLOG_Enable(1);
break; PIOS_DEBUGLOG_Printf("FlightStatus Armed: On board logging enabled.");
default: }
PIOS_DEBUGLOG_Enable(0);
} }
} }
static void SettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) static void SettingsUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)
{ {
DebugLogSettingsGet(&settings); DebugLogSettingsGet(&settings);
FlightStatusUpdatedCb(NULL); if (settings.LoggingEnabled == DEBUGLOGSETTINGS_LOGGINGENABLED_ALWAYS) {
PIOS_DEBUGLOG_Printf("On board logging enabled."); PIOS_DEBUGLOG_Enable(1);
PIOS_DEBUGLOG_Printf("On board logging enabled.");
} else if (settings.LoggingEnabled == DEBUGLOGSETTINGS_LOGGINGENABLED_DISABLED) {
PIOS_DEBUGLOG_Printf("On board logging disabled.");
PIOS_DEBUGLOG_Enable(0);
} else {
FlightStatusUpdatedCb(NULL);
}
} }
static void ControlUpdatedCb(__attribute__((unused)) UAVObjEvent *ev) static void ControlUpdatedCb(__attribute__((unused)) UAVObjEvent *ev)