Skip to content

Commit

Permalink
setpoint init rather than hacked init
Browse files Browse the repository at this point in the history
  • Loading branch information
Xnyle committed May 12, 2019
1 parent 8bf7777 commit 2782759
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ACAsetPoint.c
Expand Up @@ -93,6 +93,10 @@ BitStatus checkOverVoltageOverride(){
return 0;
}

void aca_setpoint_init(void) {
ui32_time_ticks_between_pas_interrupt_accumulated = ((uint32_t)ui16_s_ramp_start)<<3;
}

uint16_t aca_setpoint(uint16_t ui16_time_ticks_between_pas_interrupt, uint16_t setpoint_old) {
// select virtual erps speed based on speedsensor type
if (((ui16_aca_flags & EXTERNAL_SPEED_SENSOR) == EXTERNAL_SPEED_SENSOR)) {
Expand Down Expand Up @@ -143,11 +147,6 @@ uint16_t aca_setpoint(uint16_t ui16_time_ticks_between_pas_interrupt, uint16_t s
ui32_erps_accumulated -= ui32_erps_accumulated >> 3;
ui32_erps_accumulated += ui16_motor_speed_erps;
ui32_erps_filtered = ui32_erps_accumulated >> 3;

if (ui32_time_ticks_between_pas_interrupt_accumulated == 0){
// init first time here
ui32_time_ticks_between_pas_interrupt_accumulated = ((uint32_t)ui16_s_ramp_start)<<3;
}

ui32_time_ticks_between_pas_interrupt_accumulated -= ui32_time_ticks_between_pas_interrupt_accumulated >> 3;
// do not allow values > ramp_start into smoothing cause it makes startup sluggish
Expand Down
1 change: 1 addition & 0 deletions ACAsetPoint.h
Expand Up @@ -22,6 +22,7 @@
#include "config.h"

uint16_t aca_setpoint (uint16_t ui16_time_ticks_between_pas_interrupt, uint16_t setpoint_old );
void aca_setpoint_init(void);

#endif /* ACASETPOINT_H */

29 changes: 29 additions & 0 deletions Result.log
Expand Up @@ -936,3 +936,32 @@ BoardName=ST-LINK ST-LINK_ID=0 Device=STM8S105x6 Port=USB ProgMode=SWIM

>>> Loading file main.hex in PROGRAM MEMORY image in computer
No such file or directory
----------------------------------------------------------
new log session
date: 05/10/19
time: 18:21:15
----------------------------------------------------------
STVP_CmdLine version 1.6

Verbose ON
Log activity ON
Display Progress OFF
Message box warning if protect option byte ON
Loop mode OFF
Erase device OFF
Blank check device OFF
Verify device ON

Configuration:
BoardName=ST-LINK ST-LINK_ID=0 Device=STM8S105x6 Port=USB ProgMode=SWIM

>>> Filling PROGRAM MEMORY image in computer with Blank Value
<<< Filling PROGRAM MEMORY image in computer succeeds

>>> Loading file main.hex in PROGRAM MEMORY image in computer
<<< Loading file succeeds

>>> Programming PROGRAM MEMORY
Cannot communicate with the tool.
Wrong tool selection or check tool power supply or check that a previous session is closed.
<<< Programming PROGRAM MEMORY fails
1 change: 1 addition & 0 deletions main.c
Expand Up @@ -109,6 +109,7 @@ int main(void) {
adc_init();
PAS_init();
SPEED_init();
aca_setpoint_init();
#if (defined (DISPLAY_TYPE) && defined (DISPLAY_TYPE_KINGMETER)) || defined DISPLAY_TYPE_KT_LCD3 || defined BLUOSEC
display_init();
#endif
Expand Down
1 change: 1 addition & 0 deletions nbproject/private/private.xml
Expand Up @@ -38,6 +38,7 @@
<file>file:/G:/osebikefw/SPEED.c</file>
<file>file:/G:/osebikefw/motor.c</file>
<file>file:/G:/osebikefw/test/wavetables/nip_tuck_255_gen.c</file>
<file>file:/G:/osebikefw/ACAsetPoint.h</file>
<file>file:/G:/osebikefw/ACAeeprom.h</file>
<file>file:/G:/osebikefw/test/wavetables/nip_tuck_192_gen.c</file>
<file>file:/G:/osebikefw/wavetables/nip_tuck_255_gen.c</file>
Expand Down

0 comments on commit 2782759

Please sign in to comment.