Speeduino
Loading...
Searching...
No Matches
idleController_state.h
Go to the documentation of this file.
1#pragma once
2
5
6namespace idleController {
7
8namespace detail {
9
10using fnCurMicros_t = decltype(micros)*;
11
12enum class StepperStatus : uint8_t
13{
14 SOFF,
15 STEPPING,
17};
18
20{
21 int curIdleStep; //Tracks the current location of the stepper
22 int targetIdleStep; //What the targeted step is
24 volatile unsigned long stepStartTime;
25};
26
27struct state_t
28{
29 uint8_t idleUpOutputHIGH = HIGH; // Used to invert the idle Up Output
30 uint8_t idleUpOutputLOW = LOW; // Used to invert the idle Up Output
31 uint8_t idleCounter; //Used for tracking the number of calls to the idle control function
32 uint8_t idleTaper;
33
35 bool idleOn; //Simply tracks whether idle was on last time around
36 uint8_t idleInitComplete = 99; //Tracks which idle method was initialised. 99 is a method that will never exist
37 unsigned int iacStepTime_uS;
38 unsigned int iacCoolTime_uS;
39 unsigned int completedHomeSteps;
40
41 volatile bool idle_pwm_state;
43 uint16_t idle_pwm_max_count; //Used for variable PWM frequency
44 volatile unsigned int idle_pwm_cur_value;
49
52
53 integerPID idlePID; //This is the PID object if that algorithm is used. Needs to be global as it maintains state outside of each function call
54};
55
56} // detail
57
58} // fuelPumpController
A class for output pin operations that is faster than standard Arduino digitalWrite()
Definition fastOutputPin.h:10
Definition integerPID.h:7
StepperStatus
Definition idleController_state.h:13
@ STEPPING
a high pulse is currently being sent and will need to be turned off at some point.
decltype(micros) * fnCurMicros_t
Definition idleController_state.h:10
Definition idleController_state.h:6
Definition idleController_state.h:20
volatile StepperStatus stepperStatus
Definition idleController_state.h:23
int curIdleStep
Definition idleController_state.h:21
volatile unsigned long stepStartTime
Definition idleController_state.h:24
int targetIdleStep
Definition idleController_state.h:22
Definition idleController_state.h:28
unsigned int iacCoolTime_uS
Definition idleController_state.h:38
struct StepperIdle idleStepper
Definition idleController_state.h:34
volatile bool idle_pwm_state
Definition idleController_state.h:41
int32_t idle_pid_target_value
Definition idleController_state.h:45
int32_t idle_cl_target_rpm
Definition idleController_state.h:48
volatile unsigned int idle_pwm_cur_value
Definition idleController_state.h:44
bool idleOn
Definition idleController_state.h:35
fastOutputPin_t idle_pin
Definition idleController_state.h:50
uint8_t idleUpOutputLOW
Definition idleController_state.h:30
uint8_t idleUpOutputHIGH
Definition idleController_state.h:29
uint8_t idleCounter
Definition idleController_state.h:31
uint8_t idleInitComplete
Definition idleController_state.h:36
uint16_t idle_pwm_max_count
Definition idleController_state.h:43
uint8_t idleTaper
Definition idleController_state.h:32
int32_t FeedForwardTerm
Definition idleController_state.h:46
unsigned int iacStepTime_uS
Definition idleController_state.h:37
fastOutputPin_t idle2_pin
Definition idleController_state.h:51
bool lastDFCOValue
Definition idleController_state.h:42
unsigned int completedHomeSteps
Definition idleController_state.h:39
integerPID idlePID
Definition idleController_state.h:53
uint32_t idle_pwm_target_value
Definition idleController_state.h:47