Skip to content

Commit

Permalink
direction setting by P19
Browse files Browse the repository at this point in the history
  • Loading branch information
stancecoke committed Nov 9, 2024
1 parent e7e2e28 commit 018bfe5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions Inc/display_kingmeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ typedef struct
uint16_t WheelSize_mm; // Unit: 1mm
uint8_t PAS_RUN_Direction; // KM_PASDIR_FORWARD / KM_PASDIR_BACKWARD
uint8_t ExecAutodetect; // 0 or 1, Use Parameter P18 of EN06 protocol
uint8_t Reverse; // 0 or 1, Use Parameter P19 of EN06 protocol
uint8_t PAS_SCN_Tolerance; // Number of PAS signals to start the motor
uint8_t PAS_N_Ratio; // 0..255 PAS ratio
uint8_t HND_HL_ThrParam; // KM_HND_HL_NO / KM_HND_HL_YES
Expand Down
3 changes: 2 additions & 1 deletion Src/display_kingmeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ static void KM_901U_Service(KINGMETER_t* KM_ctx)
{

KM_ctx->Settings.PAS_RUN_Direction = (KM_Message[4] & 0x80) >> 7; // KM_PASDIR_FORWARD / KM_PASDIR_BACKWARD
KM_ctx->Settings.ExecAutodetect = (KM_Message[6]>>7)&0x01; // Execute Autodetect (with EN06 protocol)
KM_ctx->Settings.ExecAutodetect = (KM_Message[6]>>7)&0x01; // Execute Autodetect (with P18 of EN06 protocol)
KM_ctx->Settings.Reverse = (KM_Message[6]>>6)&0x01; // set spinning direction (with P19 of EN06 protocol)
KM_ctx->Settings.PAS_SCN_Tolerance = KM_Message[5]; // 2..9
KM_ctx->Settings.PAS_N_Ratio = KM_Message[6]; // 0..255
KM_ctx->Settings.HND_HL_ThrParam = (KM_Message[7] & 0x80) >> 7; // KM_HND_HL_NO / KM_HND_HL_YES
Expand Down
1 change: 1 addition & 0 deletions Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2160,6 +2160,7 @@ int main(void)
{
ui8_Push_Assist_flag=0;
}
i8_direction = KM.Settings.Reverse;
// MP.speedLimit=KM.Rx.SPEEDMAX_Limit;
// MP.battery_current_max = KM.Rx.CUR_Limit_mA;

Expand Down

0 comments on commit 018bfe5

Please sign in to comment.