11/*
22Library for King-Meter displays
33
4- Copyright © 2015 Michael Fabry (Michael@Fabry.de)
4+ Copyright © 2015 Michael Fabry (Michael@Fabry.de)
55
66This program is free software: you can redistribute it and/or modify
77it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2727#include "config.h"
2828#include "stdint.h"
2929
30- #if (DISPLAY_TYPE & DISPLAY_TYPE_KINGMETER )
30+ #if (DISPLAY_TYPE & DISPLAY_TYPE_KINGMETER || DISPLAY_TYPE & DISPLAY_TYPE_DEBUG )
3131
3232// Definitions
3333#define KM_MAX_WHEELTIME 0x0DAC // Maximum Wheeltime reported to the display (e.g. when wheel is stopped)
@@ -66,6 +66,8 @@ typedef struct
6666 // Parameters received from display in setting mode:
6767 uint16_t WheelSize_mm ; // Unit: 1mm
6868 uint8_t PAS_RUN_Direction ; // KM_PASDIR_FORWARD / KM_PASDIR_BACKWARD
69+ uint8_t ExecAutodetect ; // 0 or 1, Use Parameter P18 of EN06 protocol
70+ uint8_t Reverse ; // 0 or 1, Use Parameter P19 of EN06 protocol
6971 uint8_t PAS_SCN_Tolerance ; // Number of PAS signals to start the motor
7072 uint8_t PAS_N_Ratio ; // 0..255 PAS ratio
7173 uint8_t HND_HL_ThrParam ; // KM_HND_HL_NO / KM_HND_HL_YES
@@ -113,8 +115,8 @@ typedef struct
113115 uint8_t Throttle ; // KM_THROTTLE_OFF / KM_THROTTLE_ON
114116 uint8_t CruiseControl ; // KM_CRUISE_OFF / KM_CRUISE_ON
115117 uint8_t OverSpeed ; // KM_OVERSPEED_OFF / KM_OVERSPEED_ON
116- uint16_t SPEEDMAX_Limit_x10 ; // Unit: 0.1km /h
117- uint16_t CUR_Limit_x10 ; // Unit: 0.1A
118+ uint16_t SPEEDMAX_Limit ; // Unit: km /h
119+ uint16_t CUR_Limit_mA ; // Unit: mA
118120
119121}RX_PARAM_t ;
120122
@@ -123,6 +125,7 @@ typedef struct
123125#define KM_ERROR_NONE 0x00
124126#define KM_ERROR_COMM 0x30
125127#define KM_ERROR_OVHT 0x25
128+ #define KM_ERROR_IOVHT 0x26
126129
127130typedef struct
128131{
@@ -140,16 +143,16 @@ typedef struct
140143#endif
141144
142145
143- #if (DISPLAY_TYPE == DISPLAY_TYPE_KINGMETER_901U )
144- #define KM_MAX_RXBUFF 30
146+ #if (DISPLAY_TYPE == DISPLAY_TYPE_KINGMETER_901U || DISPLAY_TYPE & DISPLAY_TYPE_DEBUG )
147+ #define KM_MAX_RXBUFF 64
145148 #define KM5S_NM_RXBUFF 15 // KM5S RX-Buffer length for normal mode
146149 #define KM_MAX_TXBUFF 13
147150#endif
148151
149152typedef struct
150153{
151154 uint8_t RxState ;
152- uint32_t LastRx ;
155+ int8_t DirectSetpoint ;
153156
154157 uint8_t RxBuff [KM_MAX_RXBUFF ];
155158 uint8_t RxCnt ;
@@ -176,4 +179,3 @@ void KingMeter_Init (KINGMETER_t* KM_ctx);
176179#endif // Display Type Kingmeter
177180
178181#endif // KINGMETER_H
179-
0 commit comments