mirror of
				https://github.com/KevinMidboe/oled_workout_tracker.git
				synced 2025-10-29 17:50:28 +00:00 
			
		
		
		
	Menu mode and menu display split into two functions.
This commit is contained in:
		| @@ -151,21 +151,13 @@ void checkButtonState() { | |||||||
| } | } | ||||||
|  |  | ||||||
| String menuLookup[4] = { "daily", "weekly", "goal" }; | String menuLookup[4] = { "daily", "weekly", "goal" }; | ||||||
|  | void displayMenu() { | ||||||
| void displayMenuSelect() { |  | ||||||
|   currentPos = analogRead(potPin) / 257; // split in four (1028/4) |  | ||||||
|  |  | ||||||
|   if (pos == currentPos) { |  | ||||||
|     return;   |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   pos = currentPos; |  | ||||||
|   display.clearDisplay(); |   display.clearDisplay(); | ||||||
|   display.setTextSize(1); |   display.setTextSize(1); | ||||||
|   display.setCursor(0,0); |   display.setCursor(0,0); | ||||||
|  |  | ||||||
|   for (int i = 0; i < 4; i++) { |   for (int i = 0; i < 4; i++) { | ||||||
|     if (pos == i) { |     if (counter == i) { | ||||||
|       display.print("- "); |       display.print("- "); | ||||||
|     } else { |     } else { | ||||||
|       display.print("  ");   |       display.print("  ");   | ||||||
| @@ -182,10 +174,12 @@ void changeMode() { | |||||||
|   } |   } | ||||||
|   Serial.println("CHANGING MODE"); |   Serial.println("CHANGING MODE"); | ||||||
|  |  | ||||||
|   beingPressed = true; | int menuPos = 0; | ||||||
|   mode = !mode; | void displayMenuSelect() { | ||||||
|   delay(800); |   if (readEncoderAndUpdateCounter()) { | ||||||
|   beingPressed = false; |     displayMenu(); | ||||||
|  |   } | ||||||
|  |   delay(1); | ||||||
| } | } | ||||||
|  |  | ||||||
| void loop() { | void loop() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user