1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 16:25:26 +03:00

Second iteration of makinf F7 fast

This commit is contained in:
Pawel Spychalski (DzikuVx) 2019-03-09 14:39:00 +01:00
parent 2f226f829a
commit 7faeb47532
8 changed files with 16 additions and 16 deletions

View file

@ -520,10 +520,10 @@ static blackboxGpsState_t gpsHistory;
static blackboxSlowState_t slowHistory; static blackboxSlowState_t slowHistory;
// Keep a history of length 2, plus a buffer for MW to store the new values into // Keep a history of length 2, plus a buffer for MW to store the new values into
static blackboxMainState_t blackboxHistoryRing[3]; static EXTENDED_FASTRAM blackboxMainState_t blackboxHistoryRing[3];
// These point into blackboxHistoryRing, use them to know where to store history of a given age (0, 1 or 2 generations old) // These point into blackboxHistoryRing, use them to know where to store history of a given age (0, 1 or 2 generations old)
static blackboxMainState_t* blackboxHistory[3]; static EXTENDED_FASTRAM blackboxMainState_t* blackboxHistory[3];
static bool blackboxModeActivationConditionPresent = false; static bool blackboxModeActivationConditionPresent = false;

View file

@ -637,7 +637,7 @@ void processRx(timeUs_t currentTimeUs)
} }
// Function for loop trigger // Function for loop trigger
void taskGyro(timeUs_t currentTimeUs) { void FAST_CODE NOINLINE taskGyro(timeUs_t currentTimeUs) {
// getTaskDeltaTime() returns delta time frozen at the moment of entering the scheduler. currentTime is frozen at the very same point. // getTaskDeltaTime() returns delta time frozen at the moment of entering the scheduler. currentTime is frozen at the very same point.
// To make busy-waiting timeout work we need to account for time spent within busy-waiting loop // To make busy-waiting timeout work we need to account for time spent within busy-waiting loop
const timeDelta_t currentDeltaTime = getTaskDeltaTime(TASK_SELF); const timeDelta_t currentDeltaTime = getTaskDeltaTime(TASK_SELF);

View file

@ -24,11 +24,11 @@
#include "io/beeper.h" #include "io/beeper.h"
uint32_t armingFlags = 0; EXTENDED_FASTRAM uint32_t armingFlags = 0;
uint32_t stateFlags = 0; EXTENDED_FASTRAM uint32_t stateFlags = 0;
uint32_t flightModeFlags = 0; EXTENDED_FASTRAM uint32_t flightModeFlags = 0;
static uint32_t enabledSensors = 0; static EXTENDED_FASTRAM uint32_t enabledSensors = 0;
#if !defined(CLI_MINIMAL_VERBOSITY) #if !defined(CLI_MINIMAL_VERBOSITY)
const char *armingDisableFlagNames[]= { const char *armingDisableFlagNames[]= {
@ -80,7 +80,7 @@ uint32_t disableFlightMode(flightModeFlags_e mask)
return flightModeFlags; return flightModeFlags;
} }
bool sensors(uint32_t mask) bool FAST_CODE NOINLINE sensors(uint32_t mask)
{ {
return enabledSensors & mask; return enabledSensors & mask;
} }

View file

@ -531,7 +531,7 @@ static void FAST_CODE pidApplyFixedWingRateController(pidState_t *pidState, flig
#endif #endif
} }
static void pidApplyMulticopterRateController(pidState_t *pidState, flight_dynamics_index_t axis) static void FAST_CODE pidApplyMulticopterRateController(pidState_t *pidState, flight_dynamics_index_t axis)
{ {
const float rateError = pidState->rateTarget - pidState->gyroRate; const float rateError = pidState->rateTarget - pidState->gyroRate;

View file

@ -3168,7 +3168,7 @@ bool navigationRTHAllowsLanding(void)
(allow == NAV_RTH_ALLOW_LANDING_FS_ONLY && FLIGHT_MODE(FAILSAFE_MODE)); (allow == NAV_RTH_ALLOW_LANDING_FS_ONLY && FLIGHT_MODE(FAILSAFE_MODE));
} }
bool isNavLaunchEnabled(void) bool FAST_CODE isNavLaunchEnabled(void)
{ {
return IS_RC_MODE_ACTIVE(BOXNAVLAUNCH) || feature(FEATURE_FW_LAUNCH); return IS_RC_MODE_ACTIVE(BOXNAVLAUNCH) || feature(FEATURE_FW_LAUNCH);
} }

View file

@ -70,7 +70,7 @@ typedef struct FixedWingLaunchState_s {
bool motorControlAllowed; bool motorControlAllowed;
} FixedWingLaunchState_t; } FixedWingLaunchState_t;
static FixedWingLaunchState_t launchState; static EXTENDED_FASTRAM FixedWingLaunchState_t launchState;
#define COS_MAX_LAUNCH_ANGLE 0.70710678f // cos(45), just to be safe #define COS_MAX_LAUNCH_ANGLE 0.70710678f // cos(45), just to be safe
#define SWING_LAUNCH_MIN_ROTATION_RATE DEGREES_TO_RADIANS(100) // expect minimum 100dps rotation rate #define SWING_LAUNCH_MIN_ROTATION_RATE DEGREES_TO_RADIANS(100) // expect minimum 100dps rotation rate
@ -106,7 +106,7 @@ void resetFixedWingLaunchController(timeUs_t currentTimeUs)
launchState.motorControlAllowed = false; launchState.motorControlAllowed = false;
} }
bool isFixedWingLaunchDetected(void) bool FAST_CODE isFixedWingLaunchDetected(void)
{ {
return launchState.launchDetected; return launchState.launchDetected;
} }
@ -117,7 +117,7 @@ void enableFixedWingLaunchController(timeUs_t currentTimeUs)
launchState.motorControlAllowed = true; launchState.motorControlAllowed = true;
} }
bool isFixedWingLaunchFinishedOrAborted(void) bool FAST_CODE isFixedWingLaunchFinishedOrAborted(void)
{ {
return launchState.launchFinished; return launchState.launchFinished;
} }

View file

@ -784,7 +784,7 @@ void initializePositionEstimator(void)
* Update estimator * Update estimator
* Update rate: loop rate (>100Hz) * Update rate: loop rate (>100Hz)
*/ */
void updatePositionEstimator(void) void FAST_CODE NOINLINE updatePositionEstimator(void)
{ {
static bool isInitialized = false; static bool isInitialized = false;

View file

@ -178,7 +178,7 @@ void setTaskEnabled(cfTaskId_e taskId, bool enabled)
} }
} }
timeDelta_t getTaskDeltaTime(cfTaskId_e taskId) timeDelta_t FAST_CODE NOINLINE getTaskDeltaTime(cfTaskId_e taskId)
{ {
if (taskId == TASK_SELF) { if (taskId == TASK_SELF) {
return currentTask->taskLatestDeltaTime; return currentTask->taskLatestDeltaTime;
@ -212,7 +212,7 @@ void schedulerInit(void)
queueAdd(&cfTasks[TASK_SYSTEM]); queueAdd(&cfTasks[TASK_SYSTEM]);
} }
void scheduler(void) void FAST_CODE NOINLINE scheduler(void)
{ {
// Cache currentTime // Cache currentTime
const timeUs_t currentTimeUs = micros(); const timeUs_t currentTimeUs = micros();