Browse Source

Print a new string at each click

You can notice an interesting thing about LCD behaviour as well ...
DricomDragon 5 years ago
parent
commit
2331c1ef53
1 changed files with 5 additions and 5 deletions
  1. 5 5
      prog/sources/setup-loop.cpp

+ 5 - 5
prog/sources/setup-loop.cpp

@@ -1,7 +1,7 @@
 #include "all-headers.h"
 
 int ultimate_answer(42);
-uint32_t clicCounter(0);
+bool clickHappened(false);
 
 void setup (USER_MODE) {
 	// Enable interruption triggered by encoder clic
@@ -12,14 +12,14 @@ void setup (USER_MODE) {
 void loop (USER_MODE) {
 	assertion (ultimate_answer == 42, 101, __FILE__, __LINE__) ;
 
-	if (clicCounter > 0) {
-		gotoLineColumn(MODE_ 0, 0);
-		printString(MODE_ "Clic");
+	if (clickHappened) {
+		printString(MODE_ "Clic! ");
+		clickHappened = false;
 	}
 }
 
 void clicInterruptSection(SECTION_MODE) {
-	clicCounter ++;
+	clickHappened = true;
 
 	// Acquit interruption
 	PORTD_PCR (0) |= PORT_PCR_ISF ;