| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
-
- Queue<int> _LCD_print_queue = Queue<int>(5);
-
- struct _LCD_print_bufforS {
- int screenID;
- int cursor1;
- int cursor2;
- int character ;
- long time_seq_id;
- long time_min_run;
- } ;
- typedef struct _LCD_print_bufforS _LCD_print_bufforT;
- //struct LCDarray1S {
- // char LCDarray1[16];
- //}
- struct _LCD_print_screenS {
- int screenID;
- char LCDarray1;
- char LCDarray2;
- long time_seq_id;
- long time_min_run;
- // _LCD_print_bufforT ;
- } ;
- typedef struct _LCD_print_screenS _LCD_print_screensT;
- //_LCD_print_buffor _LCD_print_buffors[] = { 0 , 0, "T", 10000, 50000 } ;
- //_LCD_print_screen _LCD_print_screens[] = { 1 , _LCD_print_buffors } ;
- //void LCD_print_background_add( int[], int , int , int , char ,long , long ) ;
- _LCD_print_bufforT _LCD_print_buffors[1];
- _LCD_print_screensT _LCD_print_screens[10];
- void LCD_print_background_add(_LCD_print_bufforT* _LCD_print_buffors, int screenID, int cursor1, int cursor2, char character ,long time_seq_id, long time_min_run ) {
- //time_seq_id - used to maintain single display context
- //time_max - used to how much time to keep in displayed text
- // Serial.println(" runned LCD_print_background_screen_add bbuf: ");
- // Serial.print(sizeof(_LCD_print_buffors));
- Serial.print("CB:");
- int curr_buf_ind;
- int i ;
- for(i=1;i<=100;i++) {
- if(_LCD_print_buffors[i].screenID<=0) {
- Serial.print("i<=0["); Serial.print(i); Serial.print("]");
- curr_buf_ind = i;
- //if(_LCD_print_buffors[i + 1].screenID<=0)
- break;
- }
- }
- Serial.print(curr_buf_ind); Serial.print(". ");
- //char b = character.charAt(0);
- Serial.print(" added lcd buf at ind "); Serial.println(curr_buf_ind );
- int b_ascii_value = character;
- _LCD_print_buffors[curr_buf_ind] = { screenID , cursor1 , cursor2, b_ascii_value, time_seq_id , time_min_run} ;
- /*
- _LCD_print_buffors[screenID].screenID=screenID ;
- _LCD_print_buffors[screenID].cursor1=cursor1 ;
- _LCD_print_buffors[screenID].cursor2=cursor2 ;
- _LCD_print_buffors[screenID].character=b_ascii_value ;
- _LCD_print_buffors[screenID].time_seq_id=time_seq_id ;
- _LCD_print_buffors[screenID].time_min_run=time_min_run ;
- */
- }
- void LCD_print_background_screen_add(_LCD_print_screensT* _LCD_print_screens, int screenID,long time_seq_id, long time_min_run, char LCDarray1, char LCDarray2 ) {
- //time_seq_id - used to maintain single display context
- //time_max - used to how much time to keep in displayed text
-
- _LCD_print_screens[screenID].screenID=screenID ;
- _LCD_print_screens[screenID].time_seq_id=time_seq_id ;
- _LCD_print_screens[screenID].time_min_run=time_min_run ;
- _LCD_print_screens[screenID].LCDarray1=LCDarray1 ;
- _LCD_print_screens[screenID].LCDarray2=LCDarray2 ;
- Serial.print(" added to screen a1 "); Serial.println(String(LCDarray1) );
-
- // unsigned char LCDarray2buf[16];
- // LCDarray2.toCharArray(LCDarray2buf, 15);
- /*
- for ( int positionCounter1 = 0;
- positionCounter1 < 24; positionCounter1++)
- {
- LCD_print_background_add( _LCD_print_buffors, screenID, positionCounter1, 0, LCDarray1[positionCounter1], time_seq_id, time_min_run);
- Serial.print("A.");
- }
-
- for ( int positionCounter2 = 0;
- positionCounter2 < 24; positionCounter2++)
- {
- LCD_print_background_add( _LCD_print_buffors, screenID, positionCounter2, 1, LCDarray2[positionCounter2], time_seq_id, time_min_run);
- }
- Serial.print(" :");
- Serial.print(sizeof(_LCD_print_buffors));
- Serial.print(" :");
- */
- }
- // _LCD_print_bufforT _LCD_print_bufforss[] = { 0 , 0, "T", 10000, 50000 } ;
- void LCD_print_background(int cursor1, int cursor2, int character ,long time_seq_id, long time_min_run ) {
- //time_seq_id - used to maintain single display context
- //time_max - used to how much time to keep in displayed text
- }
-
- void _LCD_print_screens_list(_LCD_print_screensT* _LCD_print_screens ) {
- int i;
- Serial.print("sizeof(_LCD_print_screens): ");
- Serial.println(sizeof(_LCD_print_screens));
- for(i=0;i<=10;i++) { //sizeof(_LCD_print_buffors)
- Serial.print(" $i[");
- Serial.print(i);
- Serial.print("] screenID: ");
- Serial.print(_LCD_print_screens[i].screenID);
- String str((char*) _LCD_print_screens[i].LCDarray1);
- Serial.print(" LCDarray1 ph: ");
- Serial.println( str);
- Serial.print(" LCDarray1 len: ");
- Serial.println( sizeof(str));
-
-
- Serial.print(" LCDarray1: ");
- Serial.println( Serial.println((char*) _LCD_print_screens[i].LCDarray1) );
-
- Serial.print(" LCDarray2: ");
- Serial.write(_LCD_print_screens[i].LCDarray2);
- Serial.print(" time_seq_id: ");
-
- Serial.write( _LCD_print_screens[i].time_seq_id );
-
-
- Serial.print(" time_seq_id: ");
- Serial.println(_LCD_print_screens[i].time_seq_id);
-
-
- }
-
- }
- void _LCD_print_buffors_list(_LCD_print_bufforT* _LCD_print_buffors, int LCDtim ) {
- int i;
- Serial.print("sizeof(_LCD_print_buffors): ");
- Serial.println(sizeof(_LCD_print_buffors));
- for(i=0;i<=100;i++) { //sizeof(_LCD_print_buffors)
- Serial.print(" $i[");
- Serial.print(i);
- Serial.print("] _LCD_print_buffors screenID: ");
- Serial.print(_LCD_print_buffors[i].screenID);
-
- Serial.print(" cursor1: ");
- Serial.print(_LCD_print_buffors[i].cursor1);
- Serial.print(" cursor2: ");
- Serial.print(_LCD_print_buffors[i].cursor2);
- Serial.print(" character: ");
-
- Serial.write( _LCD_print_buffors[i].character );
-
-
- Serial.print(" time_seq_id: ");
- Serial.print(_LCD_print_buffors[i].time_seq_id);
- Serial.print(" time_min_run: ");
- Serial.println(_LCD_print_buffors[i].time_min_run);
-
- }
- lcd.setCursor(0,0);
- lcd.print("print_buffors"); // Print a message to the LCD.
- lcd.setCursor(0,1);
- lcd.print(String( _LCD_print_buffors[0].character));
- lcd.print(" , ");
- lcd.print(String( _LCD_print_buffors[1].character));
- delay(LCDtim * 5);
- }
- void LCD_print(String LCDarray1, String LCDarray2 ,int LCDtim) {
- delay(LCDtim);
- unsigned char LCDarray1buf[16];
- LCDarray1.toCharArray(LCDarray1buf, 16);
-
- unsigned char LCDarray2buf[16];
- LCDarray2.toCharArray(LCDarray2buf, 16);
- // lcd.setCursor(0,0);
- // lcd.print(LCDarray1);
- // lcd.setCursor(0,1);
- // lcd.print(LCDarray1);
- lcd.setCursor(16,0);
-
- for ( int positionCounter1 = 0;
- positionCounter1 <= 24 ;//LCDarray1.length(); // 24;
- positionCounter1++)
- {
- lcd.scrollDisplayLeft(); //Scrolls the contents of the display one space to the left.
- if(positionCounter1 >= LCDarray1.length()) lcd.print(" ");
- else lcd.print(LCDarray1[positionCounter1]); // Print a message to the LCD.
- delay(LCDtim); //wait for 250 microseconds
- if(positionCounter1==10) delay(LCDtim *7 );
- }
- // lcd.clear(); //Clears the LCD screen and positions the cursor in the upper-left corner.
-
- lcd.setCursor(16,1);
- for ( int positionCounter2 = 0;
- positionCounter2 <= 24;//LCDarray2.length();//24;
- positionCounter2++)
- {
- lcd.scrollDisplayLeft(); //Scrolls the contents of the display one space to the left.
- if(positionCounter2 >= LCDarray2.length()) lcd.print(" ");
- else lcd.print(LCDarray2[positionCounter2]); // Print a message to the LCD.
- delay(LCDtim); //wait for 250 microseconds
- if(positionCounter2==10) delay(LCDtim *7 );
- }
- delay(LCDtim * 5); //wait for 250 microseconds
- // lcd.clear(); //Clears the LCD screen and positions the cursor in the upper-left corner.
-
-
- delay(LCDtim);
-
- /*
- struct record
- {
- int bookId;
- int qtyInStock;
- };
- typedef struct record Record;
- void sold(int id, Record* records) {
- int i;
- for(i=0;i<3;i++) {
- if(records[i].bookId == id) {
- records[i].qtyInStock--;
- }
- }
- }
- */
- /*
- void updateId(int id, int new_id, Record* records) {
- int i;
- for(i=0;i<3;i++) {
- if(records[i].bookId == id) {
- records[i].bookid = new_id;
- }
- }
- }
- */
- /*
- void updateQty(int id, int new_qty, Record* records) {
- int i;
- for(i=0;i<3;i++) {
- if(records[i].bookId == id) {
- records[i].qtyInStock = new_qty;
- }
- }
- }
- */
- }
- void LCD_print1(String LCDarray1, int LCDtim) {
- delay(LCDtim);
- unsigned char LCDarray1buf[16];
- LCDarray1.toCharArray(LCDarray1buf, 16);
-
-
- lcd.setCursor(16,1);
-
- for ( int positionCounter1 = 0;
- positionCounter1 <= 24 ;//LCDarray1.length(); // 24;
- positionCounter1++)
- {
- lcd.scrollDisplayLeft(); //Scrolls the contents of the display one space to the left.
- if(positionCounter1 >= LCDarray1.length()) lcd.print(" ");
- else lcd.print(LCDarray1[positionCounter1]); // Print a message to the LCD.
- delay(LCDtim); //wait for 250 microseconds
- if(positionCounter1==10) delay(LCDtim *7 );
- }
- // lcd.clear(); //Clears the LCD screen and positions the cursor in the upper-left corner.
-
- delay(LCDtim * 5); //wait for 250 microseconds
- // lcd.clear(); //Clears the LCD screen and positions the cursor in the upper-left corner.
-
- }
-
-
- String make_str16(String str){
- for(int i = 0; i < (16 - str.length()); i++)
- str += ' ';
- return str;
- }
-
-
|