Skip to content
Permalink
Browse files

setpoint init rather than hacked init

  • Loading branch information...
Xnyle committed May 12, 2019
1 parent 8bf7777 commit 27827598a908c4df540ed54eb387770c313f9baf
Showing with 36 additions and 5 deletions.
  1. +4 −5 ACAsetPoint.c
  2. +1 −0 ACAsetPoint.h
  3. +29 −0 Result.log
  4. +1 −0 main.c
  5. +1 −0 nbproject/private/private.xml
@@ -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)) {
@@ -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
@@ -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 */

@@ -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 main.c
@@ -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
@@ -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>

0 comments on commit 2782759

Please sign in to comment.
You can’t perform that action at this time.