Skip to content

Commit

Permalink
T9 bottom bracket: Added missing defines and corrected pulse count to 32
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Kießling committed Oct 29, 2020
1 parent db3f342 commit 5895db3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
9 changes: 2 additions & 7 deletions Arduino_Pedelec_Controller/Arduino_Pedelec_Controller.ino
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,8 @@ int last_throttle_write=0; //last throttle write value
#endif
volatile byte wheel_counter=0; //counter for events that should happen once per wheel revolution. only needed if wheel_magnets>1
volatile unsigned long last_pas_event = millis(); //last change-time of PAS sensor status
#ifdef SUPPORT_SEMPU_V1
#if defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_T9)
#define pas_time 1875 //conversion factor for pas_time to rpm (cadence), 32 Pulses
#elif defined(SUPPORT_T9)
#define pas_time 3333 //conversion factor for pas_time to rpm (cadence), 18 Pulses
#else
#define pas_time 60000/pas_magnets //conversion factor for pas_time to rpm (cadence)
#endif
Expand All @@ -281,15 +279,12 @@ static volatile boolean torque_want_calculation = false; //read torque values in
#if HARDWARE_REV<20 && defined(SUPPORT_XCELL_RT)
const int torquevalues_count=8;
volatile int torquevalues[torquevalues_count]= {0,0,0,0,0,0,0,0}; //stores the 8 torque values per pedal roundtrip
#elif defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_XCELL_RT)
#elif defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_XCELL_RT) || defined(SUPPORT_T9)
const int torquevalues_count=16;
volatile int torquevalues[torquevalues_count]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //stores the 16 torque values per pedal roundtrip (Thun) or half roundtrip (Sempu)
#elif defined(SUPPORT_SEMPU)
const int torquevalues_count=24;
volatile int torquevalues[torquevalues_count]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //stores the 24 torque values per pedal roundtrip (Sempu new version)
#elif defined(SUPPORT_T9)
const int torquevalues_count=18;
volatile int torquevalues[torquevalues_count]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //stores the 18 torque values per half roundtrip (T9)
#endif
volatile byte torqueindex=0; //index to write next torque value
volatile boolean readtorque=false; //true if torque array has been updated -> recalculate in main loop
Expand Down
2 changes: 1 addition & 1 deletion Arduino_Pedelec_Controller/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ const char msg_tempomat_reset[] PROGMEM = "Tempomat reset";
const char msg_unknown_action[] PROGMEM = "Unknown action!";
const char msg_activated[] PROGMEM = "Activated";
const char msg_deactivated[] PROGMEM = "Deactivated";
#if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU)|| defined(SUPPORT_SEMPU_V1)
#if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU)|| defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_T9)
const char msg_torquezero[] PROGMEM = "Re-zero torque sensor";
#endif

Expand Down
2 changes: 1 addition & 1 deletion Arduino_Pedelec_Controller/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ static void display_nokia_view_human()
lcd.print(MY_F(" CAD "));
lcd.print(cad);
lcd.print(MY_F(" "));
#if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU) //show left bar with human and battery wh
#if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU) || defined(SUPPORT_T9) //show left bar with human and battery wh
lcd.setCursor(3,3); //print human power centered
lcd.print(MY_F(" W ")); lcd.print(power_human,0);
lcd.print(MY_F(" "));
Expand Down
4 changes: 2 additions & 2 deletions Arduino_Pedelec_Controller/switches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void action_set_soft_poti(int new_throttle_stat)

{
#if CONTROL_MODE == CONTROL_MODE_TORQUE //human power control mode
#if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU)
#if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU) || defined(SUPPORT_T9)
buffer[9]='%';
power_poti = poti_stat/1023.0* curr_power_poti_max; //power_poti_max is in this control mode interpreted as percentage. Example: power_poti_max=200 means; motor power = 200% of human power
#endif
Expand Down Expand Up @@ -337,7 +337,7 @@ static void execute_action(const sw_action action)
action_toggle_gear(true);
break;
#endif
#if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU)
#if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU) || defined(SUPPORT_T9)
case ACTION_TORQUE_ZERO:
torque_rezero();
display_show_important_info(FROM_FLASH(msg_torquezero), 2);
Expand Down

0 comments on commit 5895db3

Please sign in to comment.