@@ -31,15 +31,15 @@ BDButton TouchButtonStepMode;
31
31
const char sStepModeButtonStringContinuousStepToTurn [] PROGMEM = " Continuous\n ->\n Step to turn" ;
32
32
const char sStepModeButtonStringStepToTurnSingleStep [] PROGMEM = " Step to turn\n ->\n Single step" ;
33
33
const char sStepModeButtonStringSingleStepContinuous [] PROGMEM = " Single step\n ->\n Continuous" ;
34
- const char *const sStepModeButtonCaptionStringArray [] PROGMEM = { sStepModeButtonStringContinuousStepToTurn ,
34
+ const char *const sStepModeButtonTextStringArray [] PROGMEM = { sStepModeButtonStringContinuousStepToTurn ,
35
35
sStepModeButtonStringStepToTurnSingleStep , sStepModeButtonStringSingleStepContinuous };
36
36
37
37
#if defined(ENABLE_DISTANCE_FEEDBACK_MODE)
38
38
BDButton TouchButtonDistanceFeedbackMode;
39
39
const char sDistanceFeedbackModeNoTone [] PROGMEM = " No tone" ;
40
40
const char sDistanceFeedbackModePentatonic [] PROGMEM = " Pentatonic" ;
41
41
const char sDistanceFeedbackModeContinuous [] PROGMEM = " Continuous" ;
42
- const char *const sDistanceFeedbackModeButtonCaptionStringArray [] PROGMEM = { sDistanceFeedbackModeNoTone ,
42
+ const char *const sDistanceFeedbackModeButtonTextStringArray [] PROGMEM = { sDistanceFeedbackModeNoTone ,
43
43
sDistanceFeedbackModePentatonic , sDistanceFeedbackModeContinuous };
44
44
#endif
45
45
@@ -57,13 +57,13 @@ const char sDistanceSourceModeButtonStringMaxUS[] PROGMEM = "Max->US";
57
57
# if defined(CAR_HAS_IR_DISTANCE_SENSOR)
58
58
const char sDistanceSourceModeButtonStringUSIr [] PROGMEM = " US->IR" ;
59
59
const char sDistanceSourceModeButtonStringIrMin [] PROGMEM = " IR->Min" ;
60
- const char *const sDistanceSourceModeButtonCaptionStringArray [] PROGMEM = { sDistanceSourceModeButtonStringMinMax ,
60
+ const char *const sDistanceSourceModeButtonTextStringArray [] PROGMEM = { sDistanceSourceModeButtonStringMinMax ,
61
61
sDistanceSourceModeButtonStringMaxUS , sDistanceSourceModeButtonStringUSIr , sDistanceSourceModeButtonStringIrMin };
62
62
# else
63
63
const char sDistanceSourceModeButtonStringUSTof [] PROGMEM = " US->ToF" ;
64
64
const char sDistanceSourceModeButtonStringTofMin [] PROGMEM = " ToF->Min" ;
65
65
66
- const char * const sDistanceSourceModeButtonCaptionStringArray [] PROGMEM = { sDistanceSourceModeButtonStringMinMax , sDistanceSourceModeButtonStringMaxUS ,
66
+ const char * const sDistanceSourceModeButtonTextStringArray [] PROGMEM = { sDistanceSourceModeButtonStringMinMax , sDistanceSourceModeButtonStringMaxUS ,
67
67
sDistanceSourceModeButtonStringUSTof , sDistanceSourceModeButtonStringTofMin };
68
68
# endif
69
69
#endif
@@ -75,8 +75,8 @@ BDButton TouchButtonStartStopBuiltInAutonomousDrive;
75
75
BDButton TouchButtonFollower;
76
76
77
77
#if defined(ENABLE_DISTANCE_FEEDBACK_MODE)
78
- void setDistanceFeedbackModeButtonCaption () {
79
- TouchButtonDistanceFeedbackMode.setCaptionFromStringArrayPGM ( sDistanceFeedbackModeButtonCaptionStringArray , sDistanceFeedbackMode , true );
78
+ void setDistanceFeedbackModeButtonText () {
79
+ TouchButtonDistanceFeedbackMode.setTextFromStringArrayPGM ( sDistanceFeedbackModeButtonTextStringArray , sDistanceFeedbackMode , true );
80
80
}
81
81
82
82
#pragma GCC diagnostic ignored "-Wunused-parameter"
@@ -86,12 +86,12 @@ void doNextDistanceFeedbackMode(BDButton *aTheTouchedButton, int16_t aValue) {
86
86
sDistanceFeedbackMode = DISTANCE_FEEDBACK_NO_TONE;
87
87
noTone (BUZZER_PIN);
88
88
}
89
- setDistanceFeedbackModeButtonCaption ();
89
+ setDistanceFeedbackModeButtonText ();
90
90
}
91
91
#endif
92
92
93
- void setStepModeButtonCaption () {
94
- TouchButtonStepMode.setCaptionFromStringArray ((const __FlashStringHelper* const *) sStepModeButtonCaptionStringArray , sStepMode , (sCurrentPage == PAGE_AUTOMATIC_CONTROL));
93
+ void setStepModeButtonText () {
94
+ TouchButtonStepMode.setTextFromStringArray ((const __FlashStringHelper* const *) sStepModeButtonTextStringArray , sStepMode , (sCurrentPage == PAGE_AUTOMATIC_CONTROL));
95
95
}
96
96
97
97
/*
@@ -105,7 +105,7 @@ void setStepMode(uint8_t aStepMode) {
105
105
sDoStep = true ;
106
106
}
107
107
sStepMode = aStepMode;
108
- setStepModeButtonCaption ();
108
+ setStepModeButtonText ();
109
109
}
110
110
111
111
#pragma GCC diagnostic ignored "-Wunused-parameter"
@@ -132,16 +132,16 @@ void doStep(BDButton *aTheTouchedButton, int16_t aValue) {
132
132
}
133
133
134
134
#if defined(CAR_HAS_IR_DISTANCE_SENSOR) || defined(CAR_HAS_TOF_DISTANCE_SENSOR)
135
- void setScanModeButtonCaption () {
136
- TouchButtonScanMode.setCaptionFromStringArray ( sDistanceSourceModeButtonCaptionStringArray , sDistanceSourceMode );
135
+ void setScanModeButtonText () {
136
+ TouchButtonScanMode.setTextFromStringArray ( sDistanceSourceModeButtonTextStringArray , sDistanceSourceMode );
137
137
}
138
138
139
139
void doDistanceSourceMode (BDButton *aTheTouchedButton, int16_t aValue) {
140
140
sDistanceSourceMode ++;
141
141
if (sDistanceSourceMode > DISTANCE_LAST_SOURCE_MODE) {
142
142
sDistanceSourceMode = DISTANCE_SOURCE_MODE_MINIMUM;
143
143
}
144
- setScanModeButtonCaption ();
144
+ setScanModeButtonText ();
145
145
TouchButtonScanMode.drawButton ();
146
146
}
147
147
@@ -203,7 +203,7 @@ void initAutonomousDrivePage(void) {
203
203
204
204
TouchButtonScanSpeed.init (0 , BUTTON_HEIGHT_6_LINE_4, BUTTON_WIDTH_3_5, BUTTON_HEIGHT_8, COLOR16_BLACK, F (" Scan slow" ), TEXT_SIZE_14,
205
205
FLAG_BUTTON_DO_BEEP_ON_TOUCH | FLAG_BUTTON_TYPE_TOGGLE_RED_GREEN, false , &doChangeScanSpeed);
206
- TouchButtonScanSpeed.setCaptionForValueTrue (" Scan fast" );
206
+ TouchButtonScanSpeed.setTextForValueTrue (" Scan fast" );
207
207
208
208
#if defined(ENABLE_PATH_INFO_PAGE)
209
209
TouchButtonPathInfoPage.init (BUTTON_WIDTH_3_POS_3, 0 , BUTTON_WIDTH_3, BUTTON_HEIGHT_6, COLOR16_RED, F (" Show Path" ), TEXT_SIZE_11,
@@ -217,7 +217,7 @@ void initAutonomousDrivePage(void) {
217
217
BUTTON_WIDTH_3, TEXT_SIZE_22_HEIGHT, COLOR16_RED, F (" Start User" ), TEXT_SIZE_14,
218
218
FLAG_BUTTON_DO_BEEP_ON_TOUCH | FLAG_BUTTON_TYPE_TOGGLE_RED_GREEN, (sDriveMode == MODE_COLLISION_AVOIDING_USER),
219
219
&doStartStopTestUser);
220
- TouchButtonStartStopUserAutonomousDrive.setCaptionForValueTrue (F (" Stop User" ));
220
+ TouchButtonStartStopUserAutonomousDrive.setTextForValueTrue (F (" Stop User" ));
221
221
#endif
222
222
223
223
#if defined(ENABLE_DISTANCE_FEEDBACK_MODE)
@@ -238,12 +238,12 @@ void initAutonomousDrivePage(void) {
238
238
TouchButtonStartStopBuiltInAutonomousDrive.init (0 , BUTTON_HEIGHT_4_LINE_4, BUTTON_WIDTH_3, BUTTON_HEIGHT_4, COLOR16_RED,
239
239
F (" Start\n Builtin" ), TEXT_SIZE_22, FLAG_BUTTON_DO_BEEP_ON_TOUCH | FLAG_BUTTON_TYPE_TOGGLE_RED_GREEN,
240
240
(sDriveMode == MODE_COLLISION_AVOIDING_BUILTIN), &doStartStopAutomomousDrive);
241
- TouchButtonStartStopBuiltInAutonomousDrive.setCaptionForValueTrue (F (" Stop" ));
241
+ TouchButtonStartStopBuiltInAutonomousDrive.setTextForValueTrue (F (" Stop" ));
242
242
243
243
TouchButtonFollower.init (BUTTON_WIDTH_3_POS_2, BUTTON_HEIGHT_4_LINE_4, BUTTON_WIDTH_3, BUTTON_HEIGHT_4,
244
244
COLOR16_RED, F (" Start\n Follow" ), TEXT_SIZE_22, FLAG_BUTTON_DO_BEEP_ON_TOUCH | FLAG_BUTTON_TYPE_TOGGLE_RED_GREEN,
245
245
(sDriveMode == MODE_FOLLOWER), &doStartStopFollowerMode);
246
- TouchButtonFollower.setCaptionForValueTrue (F (" Stop\n Follow" ));
246
+ TouchButtonFollower.setTextForValueTrue (F (" Stop\n Follow" ));
247
247
}
248
248
249
249
void drawAutonomousDrivePage (void ) {
@@ -288,12 +288,12 @@ void startAutonomousDrivePage(void) {
288
288
handleAutomomousDriveRadioButtons ();
289
289
290
290
// restore last step and scan mode
291
- setStepModeButtonCaption ();
291
+ setStepModeButtonText ();
292
292
#if defined(CAR_HAS_IR_DISTANCE_SENSOR) || defined(CAR_HAS_TOF_DISTANCE_SENSOR)
293
- setScanModeButtonCaption ();
293
+ setScanModeButtonText ();
294
294
#endif
295
295
#if defined(ENABLE_DISTANCE_FEEDBACK_MODE)
296
- setDistanceFeedbackModeButtonCaption ();
296
+ setDistanceFeedbackModeButtonText ();
297
297
#endif
298
298
#if defined(ENABLE_PATH_INFO_PAGE)
299
299
#define SLIDER_SHIFTED_Y_POS BUTTON_HEIGHT_6
@@ -309,9 +309,11 @@ void startAutonomousDrivePage(void) {
309
309
SliderIROrTofDistance.setPosition (POS_X_DISTANCE_POSITION_SLIDER - (TEXT_SIZE_11_WIDTH + BUTTON_WIDTH_10), SLIDER_SHIFTED_Y_POS);
310
310
#endif
311
311
drawAutonomousDrivePage ();
312
+ #if defined(VIN_ATTENUATED_INPUT_PIN)
312
313
if (!isPWMCalibrated) {
313
314
calibrateDriveSpeedPWMAndPrint ();
314
315
}
316
+ #endif
315
317
}
316
318
317
319
// currently not used
@@ -367,11 +369,11 @@ void drawCollisionDecision(int aDegreeToTurn, uint8_t aLengthOfVector, bool aDoC
367
369
}
368
370
369
371
// draw blue (red if backwards) rotation line. The default length is sCentimetersDrivenPerScan
370
- BlueDisplay1.drawVectorDegrees (US_DISTANCE_MAP_ORIGIN_X, US_DISTANCE_MAP_ORIGIN_Y, aLengthOfVector, tDegreeToDisplay + 90 ,
372
+ BlueDisplay1.drawVectorDegree (US_DISTANCE_MAP_ORIGIN_X, US_DISTANCE_MAP_ORIGIN_Y, aLengthOfVector, tDegreeToDisplay + 90 ,
371
373
tColor);
372
374
if (!aDoClearVector) {
373
375
// Print result
374
- sprintf_P (sBDStringBuffer , PSTR (" wall%4d\xB0 rotation: %3d\xB0 wall%4d\xB0 " ), sForwardDistancesInfo .WallLeftAngleDegrees ,
376
+ snprintf_P (sBDStringBuffer , sizeof ( sBDStringBuffer ) , PSTR (" wall%4d\xB0 rotation: %3d\xB0 wall%4d\xB0 " ), sForwardDistancesInfo .WallLeftAngleDegrees ,
375
377
aDegreeToTurn, sForwardDistancesInfo .WallRightAngleDegrees ); // \xB0 is degree character
376
378
BlueDisplay1.drawText (BUTTON_WIDTH_3_5_POS_2, US_DISTANCE_MAP_ORIGIN_Y + TEXT_SIZE_11, sBDStringBuffer , TEXT_SIZE_11,
377
379
COLOR16_BLACK, COLOR16_WHITE);
0 commit comments