@@ -64,21 +64,24 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306
6464 */
6565 bool begin () {
6666 _display = new Adafruit_SSD1306 (_width, _height, _i2c);
67- bool did_begin = _display->begin (SSD1306_SWITCHCAPVCC, _sensorAddress);
67+ bool did_begin = _display->begin (
68+ SSD1306_SWITCHCAPVCC,
69+ 0x3C ); // TODO: Note that this is hardcoded, not sure why not init'd yet
6870 if (!did_begin)
6971 return false ;
7072
7173 // Show initial display buffer contents on the screen --
7274 // the library initializes this with an Adafruit splash screen.
7375 _display->display ();
74- delay (2000 );
76+ delay (1000 );
7577 // Clear the buffer
7678 _display->clearDisplay ();
7779 // Configure the text size and color
7880 _display->setTextSize (_text_sz);
7981 _display->setTextColor (SSD1306_WHITE);
8082 // Reset the cursor position
8183 _display->setCursor (0 , 0 );
84+ _display->display ();
8285 return true ;
8386 }
8487
@@ -107,18 +110,25 @@ class WipperSnapper_I2C_Driver_Out_Ssd1306
107110 if (_display == nullptr )
108111 return ;
109112 _display->clearDisplay ();
110- _display->setCursor (0 , 0 );
111113
112114 // Calculate the line height based on the text size (NOTE: base height is
113115 // 8px)
114116 int16_t line_height = 8 * _text_sz;
117+ WS_DEBUG_PRINT (" Line height: " );
118+ WS_DEBUG_PRINTLN (line_height);
115119
116120 int16_t y_idx = 0 ;
121+ _display->setCursor (0 , y_idx);
117122 for (int i = 0 ; message[i] != ' \0 ' ; i++) {
118123 if (message[i] == ' \n ' ) {
124+ WS_DEBUG_PRINTLN (" New line detected!" );
119125 y_idx += line_height;
120126 _display->setCursor (0 , y_idx);
121127 } else {
128+ WS_DEBUG_PRINT (" Printing char: " );
129+ WS_DEBUG_PRINT (message[i]);
130+ WS_DEBUG_PRINT (" at y: " );
131+ WS_DEBUG_PRINTLN (y_idx);
122132 _display->print (message[i]);
123133 }
124134 }
0 commit comments