-
Notifications
You must be signed in to change notification settings - Fork 271
New paramters in the main.h
As I'm too lazy to update the java tool, I added some parameters to the main.h for setting up some new features.
Some hubmotors have internal NTC sensor to avoid overheating the motor coils. This feature needs a pull up resistor on the ADC pin. The value of the pull up resistor has to be defined in Ohm. For a 10k resistor set:
#define R_TEMP_PULLUP 10000
if you have no NTC sensor connected, set the value to zero.
uncomment this line, if you want to use the NCTE sensor. You have to set the idle ADC-value for THROTTLE_OFFSET in the config.h and the ADC-value at maximum load for THROTTLE_MAX. Be aware, THROTTLE_OFFSET will be a bigger value than THROTTLE_MAX for the NCTE. Strange, but correct ;-)
#define NCTE
if you uncomment this line, the speed limit defined in the config.h is active and the throttle will only work up to 6kph without pedaling. With pedaling, the throttle will work up to the defined speed limit.
#define LEGALFLAG
This parameter switches off regen, if the battery is already fully charged, to prevent the BMS from switching off the battery due to overvoltage. The value has to be set in mV
#define BATTERYVOLTAGE_MAX 53000
we added the internal processor temperature reading to ramp down the motor power, if the controller gets too hot. As the calibration varies a lot from processor to processor, you can define the ADC reading at 25°C here. Alternativly, you can set the maximum current on a Display with KM5s protocol to 20.5 amps once. This will trigger an ADC reading and the calibration value will be stored in the emulated EEPROM. In this case, the value from the main.h will be ignored.
If you flash a new controller, you will need to run the autodetect routine once, to get the right angles, direction and KV constant.
If you want to flash several systems with the identical setup, you can define the values found in the autodetect routine in the main.h and then set
#define USE_FIX_POSITIONS 1
The controller will work immediatly after flashing, without the need to run the autodetect routine.