From 9b76d6766ab369fa7b84894de93fca948d45e398 Mon Sep 17 00:00:00 2001 From: Ronald Schaten Date: Tue, 1 Feb 2022 18:31:32 +0100 Subject: [PATCH] wrap printing on LCD --- PhotoStepper/PhotoStepper.ino | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/PhotoStepper/PhotoStepper.ino b/PhotoStepper/PhotoStepper.ino index 4559cb8..476f536 100644 --- a/PhotoStepper/PhotoStepper.ino +++ b/PhotoStepper/PhotoStepper.ino @@ -60,14 +60,23 @@ BasicStepperDriver stepper(STEPPER_STEPS, PIN_STEPPER_DIR, PIN_STEPPER_STEP); enum State { STATE_MENU, STATE_JOG, STATE_RUN }; State state = STATE_MENU; +void lcd_print(int line, String string) { + Serial.print("lcd_print("); + Serial.print(line); + Serial.print(", \""); + Serial.print(string); + Serial.println("\")"); + lcd.setCursor(0, line); + lcd.print(string); + for (int i = string.length(); i<16; i++) lcd.print(' '); +} + // === result enter_jog() { - lcd.setCursor(0, 0); - lcd.print("Jogging... "); - lcd.setCursor(0, 1); - lcd.print("[sel] to exit "); Serial.println("enter_jog()"); + lcd_print(0, "Jogging..."); + lcd_print(1, "[sel] to exit"); state = STATE_JOG; return proceed; } @@ -167,10 +176,8 @@ void setup() { stepper.setSpeedProfile(stepper.LINEAR_SPEED, STEPPER_ACCEL, STEPPER_DECEL); lcd.begin(16,2); - lcd.setCursor(0, 0); - lcd.print("PhotoStepper"); - lcd.setCursor(0, 1); - lcd.print("schatenseite.de"); + lcd_print(0, "PhotoStepper"); + lcd_print(1, "schatenseite.de"); delay(2000); nav.doOutput(); }