@@ -88,7 +88,7 @@ Time now;
88
88
#error Soft poti is incompatible with throttle auto cruise
89
89
#endif
90
90
91
- #if defined(SUPPORT_LIGHTS_SWITCH) && (defined(SUPPORT_XCELL_RT)||defined(SUPPORT_SEMPU )) && HARDWARE_REV < 20
91
+ #if defined(SUPPORT_LIGHTS_SWITCH) && (defined(SUPPORT_XCELL_RT)||defined(SUPPORT_SEMPU_V1 )) && HARDWARE_REV < 20
92
92
#error Software controlled lights switch is not compatible with torque sensor support on FC < 2.0
93
93
#endif
94
94
@@ -133,7 +133,7 @@ struct savings //add variables if you want to store additional values to the e
133
133
#ifdef SUPPORT_BATTERY_CHARGE_COUNTER
134
134
unsigned int charge_count;// battery charge count
135
135
#endif
136
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
136
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
137
137
float wh_human; // human watthours
138
138
#endif
139
139
};
@@ -254,7 +254,7 @@ int last_throttle_write=0; //last throttle write value
254
254
#endif
255
255
volatile byte wheel_counter=0 ; // counter for events that should happen once per wheel revolution. only needed if wheel_magnets>1
256
256
volatile unsigned long last_pas_event = millis(); // last change-time of PAS sensor status
257
- #ifdef SUPPORT_SEMPU
257
+ #ifdef SUPPORT_SEMPU_V1
258
258
#define pas_time 1875 // conversion factor for pas_time to rpm (cadence)
259
259
#else
260
260
#define pas_time 60000 /pas_magnets // conversion factor for pas_time to rpm (cadence)
@@ -271,7 +271,7 @@ double torque=0.0; //cyclist's torque in Nm (averaged over one pedal r
271
271
double torque_instant=0.0 ; // cyclist's torque in Nm (live)
272
272
double power_human=0.0 ; // cyclist's power
273
273
double wh_human=0 ;
274
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
274
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
275
275
int torque_zero=TORQUE_ZERO; // Offset of torque sensor. Adjusted at startup if TORQUE_AUTOZERO option is set
276
276
static volatile boolean analogRead_in_use = false ; // read torque values in interrupt only if no analogRead in process
277
277
static volatile boolean torque_want_calculation = false ; // read torque values in interrupt only if no analogRead in process
@@ -524,7 +524,7 @@ digitalWrite(option_pin,HIGH);
524
524
poti_stat = map (poti_value_on_startup_in_watts, 0 , curr_power_poti_max, 0 , 1023 );
525
525
#endif
526
526
527
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
527
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
528
528
#ifdef TORQUE_AUTOZERO
529
529
torque_rezero ();
530
530
#endif
@@ -662,7 +662,7 @@ if (loadcell.is_ready()) //new conversion result from load cell available
662
662
current_display = 0.99 *current_display + 0.01 *current; // averaged current for display
663
663
power=current*voltage;
664
664
665
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
665
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
666
666
#ifdef SUPPORT_XCELL_RT
667
667
torque_instant=0.49 *(analogRead (option_pin)-torque_zero); // multiplication constant for THUN X-CELL RT is approx. 0.49Nm/count
668
668
#else // SEMPU
@@ -721,7 +721,7 @@ if (loadcell.is_ready()) //new conversion result from load cell available
721
721
wh=variable.wh ;
722
722
km=variable.kilometers ;
723
723
mah=variable.mah ;
724
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
724
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
725
725
wh_human=variable.wh_human ;
726
726
#endif
727
727
}
@@ -785,7 +785,7 @@ if (loadcell.is_ready()) //new conversion result from load cell available
785
785
power_throttle = throttle_stat / 1023.0 * curr_power_max; // power currently set by throttle
786
786
787
787
#if CONTROL_MODE == CONTROL_MODE_TORQUE // human power control mode
788
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
788
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
789
789
power_poti = poti_stat/102300.0 * curr_power_poti_max*power_human*(1 +spd/20.0 ); // power_poti_max is in this control mode interpreted as percentage. Example: power_poti_max=200 means; motor power = 200% of human power
790
790
#ifdef SUPPORT_TORQUE_THROTTLE // we want to trigger throttle just by pedal torque
791
791
if (abs (torque_instant)>torque_throttle_min) // we are above the threshold to trigger throttle
@@ -1113,7 +1113,7 @@ void pas_change_dual(boolean signal)
1113
1113
#endif
1114
1114
#endif
1115
1115
1116
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
1116
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
1117
1117
void read_current_torque () // this reads the current torque value
1118
1118
{
1119
1119
torquevalues[torqueindex]=analogRead (option_pin)-torque_zero;
@@ -1137,7 +1137,7 @@ void pas_change() //Are we pedaling? PAS Sensor Change--------------------
1137
1137
if (pas_stat)
1138
1138
{
1139
1139
pas_off_time=millis ()-last_pas_event;
1140
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
1140
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
1141
1141
if (analogRead_in_use)
1142
1142
torque_want_calculation = true ;
1143
1143
else
@@ -1149,7 +1149,7 @@ void pas_change() //Are we pedaling? PAS Sensor Change--------------------
1149
1149
last_pas_event = millis ();
1150
1150
cad=pas_time/(pas_on_time+pas_off_time);
1151
1151
1152
- #ifdef SUPPORT_SEMPU
1152
+ #ifdef SUPPORT_SEMPU_V1
1153
1153
pedaling=bitRead (PINE,6 ); // read direction pin of pas sensor and set pedaling to true
1154
1154
#else
1155
1155
pas_failtime=pas_failtime+1 ;
@@ -1269,7 +1269,7 @@ void serial_debug(HardwareSerial* localSerial)
1269
1269
localSerial->print (current,1 );
1270
1270
localSerial->print (MY_F (" Power" ));
1271
1271
localSerial->print (power,0 );
1272
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
1272
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
1273
1273
localSerial->print (MY_F (" Pedaling" ));
1274
1274
localSerial->print (pedaling);
1275
1275
localSerial->print (MY_F (" Torque" ));
@@ -1510,7 +1510,7 @@ void save_eeprom()
1510
1510
#ifdef SUPPORT_BATTERY_CHARGE_COUNTER
1511
1511
variable_new.charge_count =charge_count; // save charge counter
1512
1512
#endif
1513
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
1513
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
1514
1514
variable_new.wh_human =wh_human; // save human watthours
1515
1515
#endif
1516
1516
const byte* p_new = (const byte*)(const void *)&variable_new; // pointer to new variables to save
@@ -1581,7 +1581,7 @@ void handle_unused_pins()
1581
1581
1582
1582
int analogRead_noISR (uint8_t pin) // this function makes sure that analogRead is never used in interrupt. only important for X-Cell RT bottom brackets
1583
1583
{
1584
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
1584
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
1585
1585
analogRead_in_use = true ; // this prevents analogReads in Interrupt from Thun bracket
1586
1586
if (torque_want_calculation)
1587
1587
{
@@ -1590,7 +1590,7 @@ int analogRead_noISR(uint8_t pin) //this function makes sure that analogRead is
1590
1590
}
1591
1591
#endif
1592
1592
int temp=analogRead (pin);
1593
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU )
1593
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1 )
1594
1594
analogRead_in_use = false ;
1595
1595
#endif
1596
1596
return temp;
0 commit comments