@@ -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_V1)|| defined(SUPPORT_SEMPU)
274
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU)
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
@@ -485,7 +485,7 @@ digitalWrite(option_pin,HIGH);
485
485
#ifdef SUPPORT_PAS
486
486
bitClear (DDRE,5 ); // configure PE5 as input
487
487
bitSet (PORTE,5 ); // enable pull-up on PAS sensor
488
- #if !defined(SUPPORT_XCELL_RT) && !defined(SUPPORT_BBS)&& !defined(SUPPORT_SEMPU)
488
+ #if !defined(SUPPORT_XCELL_RT) && !defined(SUPPORT_BBS) && !defined(SUPPORT_SEMPU)
489
489
bitSet (EICRB,2 ); // trigger on any edge INT5 for PAS sensor
490
490
EIMSK |= (1 <<INT5); // turn on interrupt INT5 for PAS sensor
491
491
#else
@@ -527,7 +527,7 @@ digitalWrite(option_pin,HIGH);
527
527
poti_stat = map (poti_value_on_startup_in_watts, 0 , curr_power_poti_max, 0 , 1023 );
528
528
#endif
529
529
530
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1)|| defined(SUPPORT_SEMPU)
530
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU)
531
531
#ifdef TORQUE_AUTOZERO
532
532
torque_rezero ();
533
533
#endif
@@ -665,8 +665,8 @@ if (loadcell.is_ready()) //new conversion result from load cell available
665
665
current_display = 0.99 *current_display + 0.01 *current; // averaged current for display
666
666
power=current*voltage;
667
667
668
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1)|| defined(SUPPORT_SEMPU)
669
- #ifdef SUPPORT_XCELL_RT
668
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU)
669
+ #ifdef SUPPORT_XCELL_RT
670
670
torque_instant=0.49 *(analogRead (option_pin)-torque_zero); // multiplication constant for THUN X-CELL RT is approx. 0.49Nm/count
671
671
#else // Sempu
672
672
torque_instant=0.33 *(analogRead (option_pin)-torque_zero); // multiplication constant for SEMPU V1 is approx. 0.33Nm/count
@@ -679,8 +679,8 @@ if (loadcell.is_ready()) //new conversion result from load cell available
679
679
torque+=torquevalues[i];
680
680
}
681
681
readtorque=false ;
682
- // now calculate torque_instant, torque and power
683
- #ifdef SUPPORT_XCELL_RT
682
+ // now calculate torque_instant, torque and power
683
+ #ifdef SUPPORT_XCELL_RT
684
684
#if HARDWARE_REV<20
685
685
torque=abs ((torque)*0.061 ); // torque=sum of torque values/#of torque values*5V/1023 counts/(10mV/Nm)
686
686
#else
@@ -727,7 +727,7 @@ if (loadcell.is_ready()) //new conversion result from load cell available
727
727
wh=variable.wh ;
728
728
km=variable.kilometers ;
729
729
mah=variable.mah ;
730
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1)|| defined(SUPPORT_SEMPU)
730
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU)
731
731
wh_human=variable.wh_human ;
732
732
#endif
733
733
}
@@ -791,7 +791,7 @@ if (loadcell.is_ready()) //new conversion result from load cell available
791
791
power_throttle = throttle_stat / 1023.0 * curr_power_max; // power currently set by throttle
792
792
793
793
#if CONTROL_MODE == CONTROL_MODE_TORQUE // human power control mode
794
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1)|| defined(SUPPORT_SEMPU)
794
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU)
795
795
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
796
796
#ifdef SUPPORT_TORQUE_THROTTLE // we want to trigger throttle just by pedal torque
797
797
if (abs (torque_instant)>torque_throttle_min) // we are above the threshold to trigger throttle
@@ -1072,7 +1072,7 @@ ISR(INT7_vect)
1072
1072
speed_change ();
1073
1073
}
1074
1074
#ifdef SUPPORT_PAS
1075
- #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_BBS)|| defined(SUPPORT_SEMPU)
1075
+ #if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_BBS) || defined(SUPPORT_SEMPU)
1076
1076
ISR (INT5_vect)
1077
1077
{
1078
1078
pas_change_dual (false );
@@ -1126,7 +1126,7 @@ void read_current_torque() //this reads the current torque value
1126
1126
torqueindex++;
1127
1127
if (torqueindex==torquevalues_count)
1128
1128
torqueindex=0 ;
1129
- readtorque=true ;
1129
+ readtorque=true ;
1130
1130
}
1131
1131
1132
1132
void torque_rezero () // resets torque sensor
0 commit comments