I had a ride on the bike and the resistance from the motor when trying to coast is definitely noticeable. The bike is very easy to pedal if I switch the controller off. On a more positive note, regen works really well and is good fun.
I tried again to do a diagnostic with the exact parameters you were looking for but it won't compile when I add them in. This is what I changed the printf line to
Code:
printf("%u,%u, %u, %u, %u, %u\r\n", ui8_control_state, uint32_current_target, ui16_motor_speed_erps, ui16_BatteryCurrent, ui32_SPEED_km_h, ui16_current_cal_b);
And this is the error. I have attached my current config.h
C:\BMSBattery_S_controllers_firmware-Master>PATH = C:\Program Files (x86)\STMicr
oelectronics\st_toolset\asm;C:\Program Files (x86)\Common Files\Oracle\Java\java
path;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\EDIABAS\BIN\;C:\Program Files (x86)\Universal Extrac
tor;C:\Program Files (x86)\Universal Extractor\bin;C:\Program Files\SDCC\bin;C:\
Program Files\STMicroelectronics\st_toolset\stvp;C:\Program Files (x86)\STMicroe
lectronics\st_toolset\stvp;C:\SDCC\usr\local\bin
C:\BMSBattery_S_controllers_firmware-Master>REM ;C:\BMSBattery_S_controllers_fir
mware-Master\tools\cygwin\bin
C:\BMSBattery_S_controllers_firmware-Master>cd C:\BMSBattery_S_controllers_firmw
are-Master\
C:\BMSBattery_S_controllers_firmware-Master>del main.hex
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\main.hex
C:\BMSBattery_S_controllers_firmware-Master>sdcc --version
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ez80_z80/ds390/pic16/pic14/TININativ
e/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15 4.0.0 #11528 (MINGW64)
published under GNU General Public License (GPL)
C:\BMSBattery_S_controllers_firmware-Master>make -f Makefile_windows clean
echo "Cleaning files..."
"Cleaning files..."
cmd /C del *.asm
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.asm
cmd /C del *.rel
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.rel
cmd /C del *.lk
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.lk
cmd /C del *.lst
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.lst
cmd /C del *.rst
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.rst
cmd /C del *.sym
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.sym
cmd /C del *.cdb
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.cdb
cmd /C del *.map
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.map
cmd /C del *.adb
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.adb
echo "Done."
"Done."
C:\BMSBattery_S_controllers_firmware-Master>make -f Makefile_windows
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -oBOdisplay.c BOdisplay.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -oACAcontrollerState.c ACAcontrollerState.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -oACAeeprom.c ACAeeprom.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -oACAsetPoint.c ACAsetPoint.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -oACAcommons.c ACAcommons.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -ogpio.c gpio.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -ocruise_control.c cruise_control.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -ouart.c uart.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -oadc.c adc.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -obrake.c brake.c
brake.c:23: warning 110: conditional flow changed by optimizer: so said EVELYN t
he modified DOG
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -otimers.c timers.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -opwm.c pwm.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -omotor.c motor.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -oPAS.c PAS.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -oSPEED.c SPEED.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -odisplay.c display.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debu
g -odisplay_kingmeter.c display_kingmeter.c
sdcc -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug
main.c StdPeriphLib/src/stm8s_itc.rel StdPeriphLib/src/stm8s_clk.rel StdPeriphLi
b/src/stm8s_iwdg.rel StdPeriphLib/src/stm8s_gpio.rel StdPeriphLib/src/stm8s_exti
.rel StdPeriphLib/src/stm8s_uart2.rel StdPeriphLib/src/stm8s_tim1.rel StdPeriphL
ib/src/stm8s_tim2.rel StdPeriphLib/src/stm8s_adc1.rel StdPeriphLib/src/stm8s_fla
sh.rel BOdisplay.rel ACAcontrollerState.rel ACAeeprom.rel ACAsetPoint.rel ACAcom
mons.rel gpio.rel cruise_control.rel uart.rel adc.rel brake.rel timers.rel pwm.r
el motor.rel PAS.rel SPEED.rel display.rel display_kingmeter.rel
main.c:193: error 20: Undefined identifier 'ui8_control_state'
main.c:193: error 20: Undefined identifier 'ui32_SPEED_km_h'
make: *** [main] Error 1