-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathk3ngdisplay.cpp
executable file
·719 lines (515 loc) · 23.6 KB
/
k3ngdisplay.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
#ifndef K3NG_DISPLAY_H
#define K3NG_DISPLAY_H
// K3NG_DISPLAY_LIBRARY_VERSION "1.0.2015092001"
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "k3ngdisplay.h"
#ifdef FEATURE_4_BIT_LCD_DISPLAY
#include <LiquidCrystal.h> // required for classic 4 bit interface LCD display (FEATURE_4_BIT_LCD_DISPLAY)
LiquidCrystal lcd(lcd_4_bit_rs_pin, lcd_4_bit_enable_pin, lcd_4_bit_d4_pin, lcd_4_bit_d5_pin, lcd_4_bit_d6_pin, lcd_4_bit_d7_pin);
#endif // FEATURE_4_BIT_LCD_DISPLAY
#ifdef FEATURE_WIRE_SUPPORT
#include <Wire.h> // required for FEATURE_I2C_LCD, any ADXL345 feature, FEATURE_AZ_POSITION_HMC5883L, FEATURE_EL_POSITION_ADAFRUIT_LSM303
#endif
#if defined(FEATURE_ADAFRUIT_I2C_LCD)
#include <Adafruit_MCP23017.h> // required for Adafruit I2C LCD display
#include <Adafruit_RGBLCDShield.h> // required for Adafruit I2C LCD display
#endif
#if defined(FEATURE_YOURDUINO_I2C_LCD) || defined(FEATURE_RFROBOT_I2C_DISPLAY)
#include <LiquidCrystal_I2C.h> // required for YourDuino.com or DFRobot I2C LCD display
#endif
#if defined(FEATURE_YOURDUINO_I2C_LCD)
#include <LCD.h> // required for YourDuino.com I2C LCD display
#endif
#ifdef FEATURE_ADAFRUIT_I2C_LCD
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
#endif //FEATURE_ADAFRUIT_I2C_LCD
#ifdef FEATURE_YOURDUINO_I2C_LCD
#define I2C_ADDR 0x20
#define BACKLIGHT_PIN 3
#define LED_OFF 1
#define LED_ON 0
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
#endif //FEATURE_YOURDUINO_I2C_LCD
#ifdef FEATURE_RFROBOT_I2C_DISPLAY
LiquidCrystal_I2C lcd(0x27,16,2);
#endif //FEATURE_RFROBOT_I2C_DISPLAY
int display_columns = 0;
uint8_t display_rows = 0;
char screen_buffer_live[MAX_SCREEN_BUFFER_COLUMNS*MAX_SCREEN_BUFFER_ROWS];
char screen_buffer_pending[MAX_SCREEN_BUFFER_COLUMNS*MAX_SCREEN_BUFFER_ROWS];
char screen_buffer_revert[MAX_SCREEN_BUFFER_COLUMNS*MAX_SCREEN_BUFFER_ROWS];
uint8_t screen_buffer_pending_dirty = 0;
uint8_t current_print_row = 0;
uint8_t current_print_column = 0;
unsigned long revert_screen_time = 0;
uint8_t revert_screen_flag = 0;
int update_time_ms = 0;
uint8_t last_blink_state = 0;
uint8_t timed_screen_changes_pending = 0;
uint8_t screen_buffer_attributes_live[MAX_SCREEN_BUFFER_COLUMNS*MAX_SCREEN_BUFFER_ROWS];
uint8_t screen_buffer_attributes_pending[MAX_SCREEN_BUFFER_COLUMNS*MAX_SCREEN_BUFFER_ROWS];
uint8_t screen_buffer_attributes_revert[MAX_SCREEN_BUFFER_COLUMNS*MAX_SCREEN_BUFFER_ROWS];
uint8_t current_blink_state = 0;
unsigned long next_blink_state_transition_time = TEXT_BLINK_MS;
//-----------------------------------------------------------------------------------------------------
K3NGdisplay::K3NGdisplay(int _display_columns, int _display_rows, int _update_time = 1000){
display_columns = _display_columns;
display_rows = _display_rows;
update_time_ms = _update_time;
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::initialize(){
lcd.begin(display_columns, display_rows); // if you are getting an error on this line and do not have
// any of the LCD display features enabled, remove
// k3ngdisplay.h and k3ngdisplay.cpp from your ino directory
#ifdef FEATURE_YOURDUINO_I2C_LCD
lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
lcd.setBacklight(I2C_LCD_COLOR);
#endif // FEATURE_YOURDUINO_I2C_LCD
#ifdef FEATURE_ADAFRUIT_I2C_LCD
lcd.setBacklight(I2C_LCD_COLOR);
#endif // FEATURE_ADAFRUIT_I2C_LCD
clear();
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::service(uint8_t force_update_flag = 0){
// force_update_flag = 1 : force a screen update regardless of update_time_ms, but not if there is a timed message (i.e. revert_screen_flag = 1)
// force_update_flag = 2 : force a screen update regardless of update_time_ms and revert_screen_flag
static unsigned long last_screen_buffer_pending_update_time = 0;
if (revert_screen_flag){
if (force_update_flag>1) {
update();
last_screen_buffer_pending_update_time = millis();
revert_screen_flag = 0;
screen_buffer_pending_dirty = 0;
return;
} else {
if (millis() >= revert_screen_time){
revert_back_screen();
revert_screen_flag = 0;
return;
}
}
} else {
if (((screen_buffer_pending_dirty) && ((millis() - last_screen_buffer_pending_update_time) >= update_time_ms)) || (force_update_flag>0) ) {
update();
last_screen_buffer_pending_update_time = millis();
screen_buffer_pending_dirty = 0;
}
}
// push an update immediately if we have a timed screen waiting to be displayed
if (timed_screen_changes_pending){
update();
timed_screen_changes_pending = 0;
screen_buffer_pending_dirty = 0;
return;
}
// do we need to blink text?
if (millis() >= next_blink_state_transition_time){
if (current_blink_state){
current_blink_state = 0;
} else {
current_blink_state = 1;
}
next_blink_state_transition_time = millis() + TEXT_BLINK_MS;
redraw(); // TODO - check if there are actually any blink attributes, maybe separate out blink updates?
return;
}
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::clear_pending_buffer(){
// do an immediate clearing of the screen
for (int x = 0;x < MAX_SCREEN_BUFFER_COLUMNS*MAX_SCREEN_BUFFER_ROWS;x++){
screen_buffer_pending[x] = ' ';
screen_buffer_attributes_pending[x] = 0;
}
screen_buffer_pending_dirty = 1;
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::clear(){
// do an immediate clearing of the screen
for (int x = 0;x < MAX_SCREEN_BUFFER_COLUMNS*MAX_SCREEN_BUFFER_ROWS;x++){
screen_buffer_live[x] = ' ';
screen_buffer_pending[x] = ' ';
screen_buffer_revert[x] = ' ';
screen_buffer_attributes_live[x] = 0;
screen_buffer_attributes_pending[x] = 0;
screen_buffer_attributes_revert[x] = 0;
}
lcd.clear();
current_print_row = 0;
current_print_column = 0;
revert_screen_flag = 0;
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::clear_row(uint8_t row_number){
int x = 0;
while ((buffer_index_position(x,row_number) < (display_columns * display_rows)) && (x < display_columns)) {
screen_buffer_pending[buffer_index_position(x,row_number)] = ' ';
screen_buffer_attributes_pending[buffer_index_position(x,row_number)] = 0;
x++;
}
screen_buffer_pending_dirty = 1;
}
//-----------------------------------------------------------------------------------------------------
int K3NGdisplay::Xposition(int screen_buffer_index){
return(screen_buffer_index % display_columns);
}
//-----------------------------------------------------------------------------------------------------
int K3NGdisplay::Yposition(int screen_buffer_index){
return(screen_buffer_index / display_columns);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::update(){
// update the screen with changes that are pending in screen_buffer_pending
for (int x = 0;x < (display_columns*display_rows);x++){
if (screen_buffer_live[x] != screen_buffer_pending[x]){ // do we have a new character to put on the screen ?
lcd.setCursor(Xposition(x),Yposition(x));
if (screen_buffer_attributes_pending[x] & ATTRIBUTE_BLINK){ // does this character have the blink attribute
if (current_blink_state){
lcd.print(screen_buffer_pending[x]);
} else {
lcd.print(' ');
}
} else {
lcd.print(screen_buffer_pending[x]);
}
screen_buffer_live[x] = screen_buffer_pending[x];
screen_buffer_attributes_live[x] = screen_buffer_attributes_pending[x];
} else { // not a new character, do we have live character on the screen to blink?
if (last_blink_state != current_blink_state){
if (screen_buffer_attributes_live[x] & ATTRIBUTE_BLINK){
lcd.setCursor(Xposition(x),Yposition(x));
if (current_blink_state){
lcd.print(screen_buffer_live[x]);
} else {
lcd.print(' ');
}
}
}
}
}
last_blink_state = current_blink_state;
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::redraw(){
// redraw the screen with the current screen_buffer_live
for (int x = 0;x < (display_columns*display_rows);x++){
lcd.setCursor(Xposition(x),Yposition(x));
if (screen_buffer_attributes_live[x] & ATTRIBUTE_BLINK){ // does this character have the blink attribute
if (current_blink_state){
lcd.print(screen_buffer_live[x]);
} else {
lcd.print(' ');
}
} else {
lcd.print(screen_buffer_live[x]);
}
}
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print(char * print_string, int x, int y){
print_attribute(print_string, x, y, 0);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print(char * print_string, int x, int y, uint8_t attribute){
print_attribute(print_string, x, y, attribute);
}
//-----------------------------------------------------------------------------------------------------
int K3NGdisplay::buffer_index_position(int x,int y){
return((y * display_columns) + x);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_attribute(char * print_string, int x, int y, uint8_t attribute){
for (int print_string_index = 0;print_string_index < (display_columns * display_rows);print_string_index++){
if (print_string[print_string_index] != 0){
if (((buffer_index_position(x,y)+print_string_index)) < (display_columns * display_rows)){
screen_buffer_pending[buffer_index_position(x,y)+print_string_index] = print_string[print_string_index];
screen_buffer_attributes_pending[buffer_index_position(x,y) + print_string_index] = attribute;
}
} else {
print_string_index = display_columns * display_rows;
}
}
screen_buffer_pending_dirty = 1;
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center(char * print_string,int y){
print(print_string,((display_columns/*-1*/)/2)-(length(print_string)/2),y);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_padded(char * print_string,int y,int padding){
char workstring[WORK_STRING_SIZE] = "";
for (int x = 0;(x < padding) && (strlen(workstring) < (WORK_STRING_SIZE-1));x++){
strcat(workstring," ");
}
strcat(workstring,print_string);
for (int x = 0;(x < padding) && (strlen(workstring) < (WORK_STRING_SIZE-1));x++){
strcat(workstring," ");
}
print_center(workstring,y);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_fixed_field_size(char * print_string,int y,int field_size){
char workstring[WORK_STRING_SIZE] = "";
char workstring2[WORK_STRING_SIZE] = "";
int spaces_to_add = field_size - strlen(print_string);
if (spaces_to_add > 0){
for (int x = 0;(x < (spaces_to_add/2)) && (strlen(workstring) < (WORK_STRING_SIZE-1));x++){
strcat(workstring," ");
}
}
strncpy(workstring2,print_string,field_size);
strcat(workstring,workstring2);
if (spaces_to_add > 0){
for (int x = 0;(x < (spaces_to_add/2)) && (strlen(workstring) < (WORK_STRING_SIZE-1));x++){
strcat(workstring," ");
}
if ((spaces_to_add % 2) != 0){ // odd number means we have another space to add on the end
strcat(workstring," ");
}
}
print_center(workstring,y);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center(char * print_string,int y,uint8_t text_attribute){
print_attribute(print_string,((display_columns/*-1*/)/2)-(length(print_string)/2),y,text_attribute);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_entire_row(char * print_string,int y,uint8_t text_attribute){
clear_row(y);
print_attribute(print_string,((display_columns/*-1*/)/2)-(length(print_string)/2),y,text_attribute);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_screen(char * print_string){
print_center(print_string,(display_rows-1)/2);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_screen(char * print_string,uint8_t text_attribute){
print_center(print_string,(display_rows-1)/2,text_attribute);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_screen(char * print_string,char * print_string2){
if (display_rows == 2){
print_center(print_string,0);
print_center(print_string2,1);
} else {
print_center(print_string,(display_rows/2)-1);
print_center(print_string2,(display_rows/2));
}
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_screen(char * print_string,char * print_string2,char * print_string3){
if (display_rows == 4){
print_center(print_string,0);
print_center(print_string2,1);
print_center(print_string3,2);
} else {
print_center(print_string,(display_rows/2)-1);
print_center(print_string2,(display_rows/2));
print_center(print_string3,(display_rows/2)+1);
}
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_screen(char * print_string,char * print_string2,char * print_string3,char * print_string4){
if (display_rows == 4){
print_center(print_string,0);
print_center(print_string2,1);
print_center(print_string3,2);
print_center(print_string4,3);
} else {
print_center(print_string,(display_rows/2)-1);
print_center(print_string2,(display_rows/2));
print_center(print_string3,(display_rows/2)+1);
print_center(print_string4,(display_rows/2)+3);
}
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_right(char * print_string,int y){
print(print_string,display_columns-length(print_string),y);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_left(char * print_string,int y){
print(print_string,0,y);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_left_padded(char * print_string,int y,int padding){
char workstring[WORK_STRING_SIZE] = "";
strcpy(workstring,print_string);
for (int x = 0;(x < padding) && (strlen(workstring) < (WORK_STRING_SIZE-1));x++){
strcat(workstring," ");
}
print_left(workstring,y);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_left_fixed_field_size(char * print_string,int y,int field_size){
char workstring[WORK_STRING_SIZE] = "";
strncpy(workstring,print_string,field_size);
print_left_padded(workstring, y, field_size - strlen(print_string));
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_right_fixed_field_size(char * print_string,int y,int field_size){
char workstring[WORK_STRING_SIZE] = "";
strncpy(workstring,print_string,field_size);
print_right_padded(workstring, y, field_size - strlen(print_string));
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_right_padded(char * print_string,int y,int padding){
char workstring[WORK_STRING_SIZE] = "";
for (int x = 0;(x < padding) && (strlen(workstring) < (WORK_STRING_SIZE-1));x++){
strcat(workstring," ");
}
strcat(workstring,print_string);
print_right(workstring,y);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_top_right(char * print_string){
print(print_string,display_columns-length(print_string),0);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_top_left(char * print_string){
print(print_string,0,0);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_bottom_right(char * print_string){
print(print_string,display_columns-length(print_string),display_rows-1);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_bottom_left(char * print_string){
print(print_string,0,display_rows-1);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::row_scroll(){
for (int x = 0; x < display_columns; x++){
for (int y = 0; y < display_rows; y++){
if (y < (display_rows-1)){
screen_buffer_pending[buffer_index_position(x,y)] = screen_buffer_pending[buffer_index_position(x,y+1)];
screen_buffer_attributes_pending[buffer_index_position(x,y)] = screen_buffer_attributes_pending[buffer_index_position(x,y+1)];
} else {
screen_buffer_pending[buffer_index_position(x,y)] = ' ';
screen_buffer_attributes_pending[buffer_index_position(x,y)] = 0;
}
}
}
screen_buffer_pending_dirty = 1;
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print(char * print_string){
print_attribute(print_string, 0);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::println(char * print_string){
char workstring[WORK_STRING_SIZE] = "";
strcpy(workstring,print_string);
if (strlen(workstring) < (WORK_STRING_SIZE-2)){
strcat(workstring,"\n");
}
print_attribute(workstring, 0);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_attribute(char * print_string, uint8_t text_attribute){
for (int print_string_index = 0;print_string_index < (display_columns * display_rows);print_string_index++){
switch (print_string[print_string_index]){
case 0: return; break;
case '\n':
current_print_column = display_columns;
break;
default:
if (current_print_column >= display_columns){
current_print_column = 0;
current_print_row++;
if (current_print_row >= display_rows){ // we're at the end of the display
row_scroll();
current_print_row--;
}
}
screen_buffer_pending[buffer_index_position(current_print_column,current_print_row)] = print_string[print_string_index];
screen_buffer_attributes_pending[buffer_index_position(current_print_column,current_print_row)] = text_attribute;
current_print_column++;
break;
}
}
screen_buffer_pending_dirty = 1;
}
//-----------------------------------------------------------------------------------------------------
int K3NGdisplay::length(char * print_string){
int char_count = 0;
for (int x = 0;x < (display_columns * display_rows);x++){
if (print_string[x] != 0){
char_count++;
} else {
x = display_columns * display_rows;
}
}
return char_count;
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::prepare_for_timed_screen(int ms_to_display){
save_current_screen_to_revert_screen_buffer();
revert_screen_flag = 1;
revert_screen_time = millis() + ms_to_display;
timed_screen_changes_pending = 1;
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_timed_message(char * print_string,int ms_to_display,uint8_t text_attribute){
prepare_for_timed_screen(ms_to_display);
print_center_screen(print_string,text_attribute);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_timed_message(char * print_string,int ms_to_display){
prepare_for_timed_screen(ms_to_display);
print_center_screen(print_string);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_timed_message(char * print_string,char * print_string2,int ms_to_display){
prepare_for_timed_screen(ms_to_display);
print_center_screen(print_string,print_string2);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_timed_message(char * print_string,char * print_string2,char * print_string3,int ms_to_display){
prepare_for_timed_screen(ms_to_display);
print_center_screen(print_string,print_string2,print_string3);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::print_center_timed_message(char * print_string,char * print_string2,char * print_string3,char * print_string4,int ms_to_display){
prepare_for_timed_screen(ms_to_display);
print_center_screen(print_string,print_string2,print_string3,print_string4);
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::save_current_screen_to_revert_screen_buffer(){
for (int x = 0;x < MAX_SCREEN_BUFFER_COLUMNS*MAX_SCREEN_BUFFER_ROWS;x++){
screen_buffer_revert[x] = screen_buffer_live[x];
screen_buffer_pending[x] = ' ';
screen_buffer_attributes_revert[x] = screen_buffer_attributes_live[x];
screen_buffer_attributes_pending[x] = 0;
}
}
//-----------------------------------------------------------------------------------------------------
/*
void K3NGdisplay::push_revert_screen_buffer_to_live_buffer(){
for (int x = 0;x < MAX_SCREEN_BUFFER_COLUMNS*MAX_SCREEN_BUFFER_ROWS;x++){
screen_buffer_live[x] = screen_buffer_revert[x];
screen_buffer_attributes_live[x] = screen_buffer_attributes_revert[x];
}
}
*/
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::push_revert_screen_buffer_to_pending_buffer(){
for (int x = 0;x < MAX_SCREEN_BUFFER_COLUMNS*MAX_SCREEN_BUFFER_ROWS;x++){
screen_buffer_pending[x] = screen_buffer_revert[x];
screen_buffer_attributes_pending[x] = screen_buffer_attributes_revert[x];
}
}
//-----------------------------------------------------------------------------------------------------
void K3NGdisplay::revert_back_screen(){
//push_revert_screen_buffer_to_live_buffer();
push_revert_screen_buffer_to_pending_buffer();
//redraw();
update();
}
//-----------------------------------------------------------------------------------------------------
#endif //K3NG_DISPLAY_H