17
17
18
18
#include " DigisparkOLED.h"
19
19
#include " font6x8.h"
20
- #include " font8x16.h"
21
20
21
+ #ifndef _nofont_8x16 // tBUG Optional removal to save code space
22
+ #include " font8x16.h"
23
+ #endif
22
24
23
25
24
26
// ----------------------------------------------------------------------------
@@ -153,18 +155,27 @@ size_t SSD1306Device::write(byte c) {
153
155
if (c == ' \r ' )
154
156
return 1 ;
155
157
if (c == ' \n ' ){
156
- if (oledFont == 0 )
157
- setCursor (0 , oledY+1 );
158
- else
159
- setCursor (0 , oledY+2 );
158
+ if (oledFont == FONT6X8) { // tBUG
159
+ oledY++;
160
+ // if ( oledY > 7) // tBUG
161
+ // oledY = 7;
162
+ }
163
+ else {
164
+ oledY+=2 ; // tBUG Large Font up by two
165
+ if ( oledY > 6 ) // tBUG
166
+ oledY = 6 ;
167
+ }
168
+ setCursor (0 , oledY);
160
169
return 1 ;
161
170
}
162
171
163
- if (oledFont == 0 ){
172
+ if (oledFont == FONT6X8 ){
164
173
if (oledX > 122 )
165
174
{
166
175
oledX = 0 ;
167
176
oledY++;
177
+ if ( oledY > 7 ) // tBUG
178
+ oledY = 7 ;
168
179
setCursor (oledX, oledY);
169
180
}
170
181
@@ -176,11 +187,15 @@ size_t SSD1306Device::write(byte c) {
176
187
ssd1306_send_data_stop ();
177
188
setCursor (oledX+6 , oledY);
178
189
}
190
+ #ifndef _nofont_8x16 // tBUG
179
191
else {
180
192
if (oledX > 120 )
181
193
{
182
194
oledX = 0 ;
183
- oledY++;
195
+ oledY+=2 ; // tBUG Large Font up by two
196
+ // oledY++;
197
+ if ( oledY > 6 ) // tBUG
198
+ oledY = 6 ;
184
199
setCursor (oledX, oledY);
185
200
}
186
201
@@ -198,8 +213,8 @@ size_t SSD1306Device::write(byte c) {
198
213
}
199
214
ssd1306_send_data_stop ();
200
215
setCursor (oledX + 8 , oledY - 1 );
201
-
202
216
}
217
+ #endif
203
218
return 1 ;
204
219
}
205
220
@@ -210,9 +225,9 @@ void SSD1306Device::bitmap(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, const
210
225
{
211
226
uint16_t j = 0 ;
212
227
uint8_t y, x;
213
- if (y1 % 8 == 0 ) y = y1 / 8 ;
214
- else y = y1 / 8 + 1 ;
215
- for (y = y0; y < y1; y++)
228
+ // if (y1 % 8 == 0) y = y1 / 8; // else y = y1 / 8 + 1; // tBUG :: this does nothing as y is initialized below
229
+ // THIS PARAM rule on y makes any adjustment here WRONG //usage oled.bitmap(START X IN PIXELS, START Y IN ROWS OF 8 PIXELS, END X IN PIXELS, END Y IN ROWS OF 8 PIXELS, IMAGE ARRAY) ;
230
+ for (y = y0; y < y1; y++)
216
231
{
217
232
setCursor (x0,y);
218
233
ssd1306_send_data_start ();
0 commit comments