General cleanup
This commit is contained in:
@ -127,15 +127,15 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) {
|
||||
|
||||
// if must encoder rati multiplier
|
||||
if (EncoderRate.encoderRateEnabled) {
|
||||
const float abs_diff = ABS(temp_diff);
|
||||
const float encoderMovementSteps = abs_diff / (ENCODER_PULSES_PER_STEP);
|
||||
const float abs_diff = ABS(temp_diff),
|
||||
encoderMovementSteps = abs_diff / (ENCODER_PULSES_PER_STEP);
|
||||
if (EncoderRate.lastEncoderTime) {
|
||||
// Note that the rate is always calculated between two passes through the
|
||||
// loop and that the abs of the temp_diff value is tracked.
|
||||
const float encoderStepRate = encoderMovementSteps / float(ms - EncoderRate.lastEncoderTime) * 1000;
|
||||
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100;
|
||||
else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
|
||||
else if (encoderStepRate >= ENCODER_5X_STEPS_PER_SEC) encoderMultiplier = 5;
|
||||
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100;
|
||||
else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
|
||||
else if (encoderStepRate >= ENCODER_5X_STEPS_PER_SEC) encoderMultiplier = 5;
|
||||
}
|
||||
EncoderRate.lastEncoderTime = ms;
|
||||
}
|
||||
|
@ -55,9 +55,9 @@ extern ENCODER_Rate EncoderRate;
|
||||
|
||||
typedef enum {
|
||||
ENCODER_DIFF_NO = 0,
|
||||
ENCODER_DIFF_CW = 1,
|
||||
ENCODER_DIFF_CW = 1,
|
||||
ENCODER_DIFF_CCW = 2,
|
||||
ENCODER_DIFF_ENTER = 3
|
||||
ENCODER_DIFF_ENTER = 3
|
||||
} ENCODER_DiffState;
|
||||
|
||||
/*编码器初始化 PB12:Encoder_A PB13:Encoder_B PB14:Encoder_C*/
|
||||
@ -87,7 +87,7 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void);
|
||||
/*状态LED初始化*/
|
||||
void STATE_LED_Configuration(void);
|
||||
|
||||
/*LED灯操作*/
|
||||
/*LED灯操作*/
|
||||
void LED_Action(void);
|
||||
|
||||
/*LED初始化*/
|
||||
|
Reference in New Issue
Block a user