Skip to content

Commit

Permalink
changed debug
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomo892 committed May 22, 2018
1 parent 7928c11 commit c632237
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/main/build/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ typedef enum {
DEBUG_FPORT,
DEBUG_ALWAYS,
DEBUG_STAGE2,
DEBUG_CRUISE,
DEBUG_COUNT
} debugType_e;

Expand Down
2 changes: 1 addition & 1 deletion src/main/fc/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ tables:
- name: i2c_speed
values: ["400KHZ", "800KHZ", "100KHZ", "200KHZ"]
- name: debug_modes
values: ["NONE", "GYRO", "NOTCH", "NAV_LANDING", "FW_ALTITUDE", "AGL", "FLOW_RAW", "SBUS", "FPORT", "ALWAYS", "STAGE2"]
values: ["NONE", "GYRO", "NOTCH", "NAV_LANDING", "FW_ALTITUDE", "AGL", "FLOW_RAW", "SBUS", "FPORT", "ALWAYS", "STAGE2","CRUISE"]
- name: async_mode
values: ["NONE", "GYRO", "ALL"]
- name: aux_operator
Expand Down
12 changes: 6 additions & 6 deletions src/main/navigation/navigation.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_IDLE(navigationFSMState
{
UNUSED(previousState);
resetNavigation();
debug[0]=0;
DEBUG_SET(DEBUG_CRUISE, 0, 0);
return NAV_FSM_EVENT_NONE;
}

Expand Down Expand Up @@ -873,7 +873,7 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_CRUISE_2D_INITIALIZE(na
{
const navigationFSMStateFlags_t prevFlags = navGetStateFlags(previousState);

debug[0]=1;
DEBUG_SET(DEBUG_CRUISE, 0, 1);
if(checkForPositionSensorTimeout()){ return NAV_FSM_EVENT_SWITCH_TO_IDLE; } //we do not have an healty position. switch to idle and try on next iteration

if (!STATE(FIXED_WING)) {return NAV_FSM_EVENT_ERROR;} //only on FW for now
Expand Down Expand Up @@ -904,15 +904,15 @@ static navigationFSMEvent_t navOnEnteringState_NAV_STATE_CRUISE_2D_IN_PROGRESS(n
if(checkForPositionSensorTimeout()){ return NAV_FSM_EVENT_SWITCH_TO_IDLE; } //in case of invalid position, re init.

if(posControl.flags.isAdjustingPosition || posControl.flags.isAdjustingHeading) { return NAV_FSM_EVENT_SWITCH_TO_IDLE; } //pilot has input a roll command (need to take YAW in account too!!!!) and the new heading to maintain has to be processed
debug[0]=2;
debug[1]=0;
DEBUG_SET(DEBUG_CRUISE, 0, 2);
DEBUG_SET(DEBUG_CRUISE, 1, 0);
if(calculateDistanceToDestination(&posControl.cruise.cruiseTargetPos)<navConfig()->fw.cruise_virtual_wp_radius){

int32_t targetDistance = gpsSol.groundSpeed*navConfig()->fw.cruise_virtual_nav_cruise_virtual_nextwp_multiplier;
debug[2]= targetDistance;
DEBUG_SET(DEBUG_CRUISE, 2, targetDistance);
calculateNewCruiseTarget(&posControl.cruise.cruiseTargetPos, posControl.cruise.cruiseYaw, targetDistance);
setDesiredPosition(&posControl.cruise.cruiseTargetPos, posControl.cruise.cruiseYaw, NAV_POS_UPDATE_XY | NAV_POS_UPDATE_HEADING);
debug[1]=1;
DEBUG_SET(DEBUG_CRUISE, 1, 1);
}

return NAV_FSM_EVENT_NONE;
Expand Down

0 comments on commit c632237

Please sign in to comment.