Console Serial IO con display OLED e seriale asincrona
Dependencies: mbed BufferedSerial AserialIOFuncLib SSD1306 TerminalPlusV2
Fork of SerialIO by
Console Serial IO con display OLED e seriale asincrona
Revision 38:d88296cbb39c, committed 2015-12-24
- Comitter:
- MaxScorda
- Date:
- Thu Dec 24 01:38:56 2015 +0000
- Parent:
- 37:befd2fe96ee3
- Child:
- 39:0d7165083e7a
- Commit message:
- Sistemazione Output, pre passaggio dati
Changed in this revision
--- a/AserialIOFuncLib.lib Fri Nov 06 22:31:17 2015 +0000 +++ b/AserialIOFuncLib.lib Thu Dec 24 01:38:56 2015 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/MaxScorda/code/AserialIOFuncLib/#149091052948 +https://developer.mbed.org/users/MaxScorda/code/AserialIOFuncLib/#93274a65f664
--- a/Functions.h Fri Nov 06 22:31:17 2015 +0000 +++ b/Functions.h Thu Dec 24 01:38:56 2015 +0000 @@ -2,6 +2,9 @@ #include "IOFuncLib.h" #include "choiceFunctions.h" +//Valori di Menu +int p01, p02, p03; +int p51, p52; void bannerAdv() { @@ -11,58 +14,62 @@ term.frame(0, 0, 79, 22,1); term.forgcol(3); term.bold(); - term.formatPrintf("_____ Glass Project Console _____\n",22,1); - term.formatPrintf("___ Nucleo Scorda IO Terminal ___\n",22,2); + term.formatPrintf("_____ H-Ard Synth Project Console _____\n",19,1); + term.formatPrintf("______ Nucleo Scorda IO Terminal ______\n",19,2); term.resetattrib(); term.forgcol(7); //3-4 term.formatPrintf(fnzAdd.string2char(fnzAdd.padstr("\n",78,char(196))),1,3,1); //top 1/2 term.forgcol(6); - term.formatPrintf("Funzione \n",2,4); //p01 - term.formatPrintf("Numero \n",32,4); //p02 - term.formatPrintf("Parametro \n",51,4); //p03 -//5-6 + /* + //5-6 term.formatPrintf("Pattern 0......... \n",2,6); //p11 term.formatPrintf("Pattern 1......... \n",42,6); //p12 -//7-8 + //7-8 term.formatPrintf("Pattern 2......... \n",2,8); //p21 term.formatPrintf("Random Act (r1o/f) \n",42,8); //p22 -//9-10 + //9-10 term.formatPrintf("Serial Real(sro/f) \n",2,10); //p31 -//11-12 + //11-12 term.formatPrintf("Note Pattern......\n",2,12,99); //p41 -//13-14 - term.formatPrintf("Input string...... \n",2,14); //p51 - term.formatPrintf("Command Type...... \n",42,14); //p52 -//15-16 + */ +//18-19 + p51=18; + p52=18; + term.formatPrintf("Input string...... \n",2,p51); //p51 + term.formatPrintf("Command Type \n",48,p52); //p52 + p01=19; + p02=19; + p03=19; + term.formatPrintf("Funzione \n",2,p01); //p01 + term.formatPrintf("Numero \n",32,p02); //p02 + term.formatPrintf("Parametro \n",51,p03); //p03 +//21 term.forgcol(7); term.formatPrintf("Serial Feedback \n",2,21); // grigino + /* + term.formatPrintf(fnzAdd.string2char(fnzAdd.padstr("\n",78,char(196))),1,5); //top 3/4 + term.formatPrintf(fnzAdd.string2char(fnzAdd.padstr("\n",78,char(196))),1,9); //top 7/8 + term.formatPrintf(fnzAdd.string2char(fnzAdd.padstr("\n",78,char(196))),1,13); //top 11/12 - term.formatPrintf(fnzAdd.string2char(fnzAdd.padstr("\n",78,char(196))),1,5); //top 3/4 - term.formatPrintf(fnzAdd.string2char(fnzAdd.padstr("\n",78,char(196))),1,9); //top 7/8 - term.formatPrintf(fnzAdd.string2char(fnzAdd.padstr("\n",78,char(196))),1,13); //top 11/12 - term.formatPrintf(fnzAdd.string2char(fnzAdd.padstr("\n",78,char(196))),1,15,1); //bottom pot - term.formatPrintf(fnzAdd.string2char(fnzAdd.padstr("\n",78,char(196))),1,20); //azzo funziona... + - term.forgcol(2); - term.formatPrintf("Pattern: da 031 a 252 - Traccia 0-2, Note 3-6, Len 1-2 \n",2,16); //help - term.formatPrintf("Stato random: r1on-r1off \n",2,17); //help - term.formatPrintf("Cambia Note: da n01 a n53 - Nota 0-5, Val 1-3 \n",2,18); //help - term.formatPrintf("start, stop, dstop (delay) - rl: reload value\n",2,19); //help - term.forgcol(7); + term.forgcol(2); + term.formatPrintf("Pattern: da 031 a 252 - Traccia 0-2, Note 3-6, Len 1-2 \n",2,16); //help + term.formatPrintf("Stato random: r1on-r1off \n",2,17); //help + term.formatPrintf("Cambia Note: da n01 a n53 - Nota 0-5, Val 1-3 \n",2,18); //help + term.formatPrintf("start, stop, dstop (delay) - rl: reload value\n",2,19); //help + term.forgcol(7); + */ + term.formatPrintf(fnzAdd.string2char(fnzAdd.padstr("\n",78,char(196))),1,17,1); //bottom pot + term.formatPrintf(fnzAdd.string2char(fnzAdd.padstr("\n",78,char(196))),1,20); //azzo funziona... term.locate(0, 23); printf("Command: > "); - // extra da attivare forse - // formatPrintf("Pattern \n",2,5); - // formatPrintf(string2char(padstr("\n",78,char(196))),1,7); //top 5/6 - // formatPrintf(string2char(padstr("\n",78,char(196))),1,11); //top 9/10 - // formatPrintf("Serial \n",2,9); - // formatPrintf("HELP \n",2,15); //help } @@ -96,36 +103,35 @@ funcnum=strIn.substr(1,1); param=strIn.substr(2,3); //write param - term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(func)),11,4,10,1); //p01 - term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(funcnum)),39,4,10,1); //p02 - term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(param)),61,4,10,1); //p03 + term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(func)),11,p01,10,1); //p01 + term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(funcnum)),39,p02,10,1); //p02 + term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(param)),61,p03,10,1); //p03 //write input string - term.formatPrintf(fnzAdd.string2char(strIn),21,14,10,1); //p51 + term.formatPrintf(fnzAdd.string2char(strIn),21,p51,10,1); //p51 //term.formatPrintf(((char*)func.c_str() ,02,07); funziona anche cosi' - //extra serial output (output reale su arduino default true) - if ((func=="s") && (funcnum=="r") ) { - errp=Sfunc(func, funcnum,param); + //command Cambia Funzione + if (func=="f") { + errp=funcOut(func, funcnum,param, string(stringa)); } - //Random Activate - else if (func=="r") { - errp=RfuncOut(func, funcnum,param); + //init: al boot chiedi ad arduino i codici + else if (func=="i") { + errp=initFunc(func, funcnum,param); } - //led for test else if (func=="l") { errp=Lfunc(func, funcnum,param); } - //command SYNTH Tracce - else if ((func>="0") && (func<="9")) { - errp=s09funcOut(func, funcnum,param,stringa[0]); + //command Cambia menu + else if (func=="m") { + errp=menuOut(func, funcnum,param, string(stringa)); } - //command SYNTH Note - else if (func=="n") { - errp=NfuncOut(func, funcnum,param, stringa); + //Random Activate DA FARE!!!!!!!!! + else if (func=="r") { + errp=RfuncOut(func, funcnum,param); } //start @@ -138,21 +144,16 @@ errp=StopfuncOut(); } - //delay stop - else if (strIn.substr(0,5)=="dstop") { - errp=DelayStopfuncOut(); - } - // comando fuori parsing if (errp==1) { term.forgcol(1); - term.formatPrintf("Bad Command\n",61,14,99,1); //p52 + term.formatPrintf("Bad Command\n",61,p52,99,1); //p52 term.forgcol(9); if (realExtraSerial==false) ardser.printf("Bad command\n\r"); printDisp(dispType,"** Bad command ** \n\r"); } - + term.readypos(); } @@ -164,26 +165,20 @@ string param; //parametro on, off string strIn = string(stringa); bool errp=1; - //pad a 4 - strIn=fnzAdd.padstr(strIn,5,' '); + strIn=fnzAdd.padstr(strIn,5,' '); //non dovrebbe servire strIn=fnzAdd.addEOS(strIn); //split func=strIn.substr(0,1); funcnum=strIn.substr(1,1); param=strIn.substr(2,3); - //Random Activate - if (func=="r") { - errp=RfuncIn(func, funcnum,param); + //Descrizione Menu in input + if (func=="m") { + errp=menuIn(func, stringa); } - //command SYNTH Tracce - else if ((func>="0") && (func<="9")) { - errp=s09funcIn(func, funcnum,param,stringa[0]); - //ardser.printf(strIn+" \n\r"); - } - //command SYNTH Note - else if (func=="n") { - errp=NfuncIn(func, funcnum,param, stringa); + //Descrizione funzione in input + else if (func=="f") { + errp=functionIn(func, stringa); } //start else if (strIn.substr(0,4)=="start") { @@ -194,16 +189,6 @@ errp=StopfuncIn(); } - //delay stop - else if (strIn.substr(0,4)=="dstop") { - errp=DelayStopfuncIn(); - } - - //Boot - else if (strIn.substr(0,4)=="boot") { - errp=bootfuncIn(); - } - term.formatPrintf(fnzAdd.string2char(">"+fnzAdd.subEOS(string(stringa))+"<"),18,21,99,1); term.readypos(); } @@ -215,7 +200,20 @@ string param; //parametro on, off string strIn; + //azzero vettori + for (int i = 0; i < 10; i++) { + menu_main[i]=""; + menu_funcChoice[i]=""; + } + for (int i = 0; i < 100; i++) { + menu_function[i]=""; + } + menu_main[0]="z.z"; //invero e' sbagliato. controllare cosa usa di stop + menu_funcChoice[0]="z.z"; + menu_function[0]="z.z"; + //pattern + /* for (int i = 0; i < 3; i++) { strIn=fnzAdd.i2s(i)+"-"+fnzAdd.i2s(i+3)+"-"+fnzAdd.i2s(2); term.formatPrintf(fnzAdd.string2char(strIn),21+(i%2)*40,6+(2*(i/2)),8,1); //p11 //p12 //p21 @@ -226,6 +224,7 @@ term.formatPrintf("ON\n",61,8,99,1); //p22 // note term.formatPrintf("60 64 67 71 74 77\n",21,12,99,1); //p41 + */ term.readypos(); } @@ -234,8 +233,8 @@ void pressed() { ardser.printf("rl\r"); - term.formatPrintf("rl\n",21,14,8,1); //p51 - term.formatPrintf("Ask for reload\n",61,14,99,1); //p52 + term.formatPrintf("rl\n",21,p51,8,1); //p51 + term.formatPrintf("Ask for reload\n",61,p52,99,1); //p52 led.flash(2); }
--- a/choiceFunctions.h Fri Nov 06 22:31:17 2015 +0000 +++ b/choiceFunctions.h Thu Dec 24 01:38:56 2015 +0000 @@ -1,25 +1,117 @@ - -//********************* Serial 4 real -bool Sfunc(string func, string funcnum, string param) +bool funcOut(string func, string funcnum, string param, string sstr) { + //fare bool errp=1; - if (param=="on ") { - realExtraSerial=true; - term.formatPrintf("ON \n",21,10,3,1); //p31 - term.formatPrintf("RS Attiva \n",61,14,99,1); //p52 - printDisp(dispType,"RS Attiva \n\r"); - errp=0; - } - if (param=="off") { - realExtraSerial=false; - term.formatPrintf("OFF\n",21,10,3,1); //p31 - term.formatPrintf("RS Disattivata \n",61,14,99); //p52 - if (realExtraSerial==false) ardser.printf("\nRS OFF \n\r"); - printDisp(dispType,"RS Disattivata \n\r"); + char funcc; + int tempcc=0; + funcc=*fnzAdd.string2char(fnzAdd.addEOS(funcnum)); + + if ((funcnum>="0") && (funcnum<="9")) { + while (menu_funcChoice[tempcc]!="z") { + tempcc++; + } + if (menu_funcChoice[tempcc]=="z") tempcc--; + funcidx=tempcc; + errp=0; } return errp; } +//********************* Init: chiama Arduino al boot e chiama i paramtri +bool initFunc(string func, string funcnum, string param) +{ + bool errp=1; + + if (funcnum=="1") { + // errp=menuIn("0", param); + + } + return errp; +} + + +//********************* Led +bool Lfunc(string func, string funcnum, string param) +{ + bool errp=1; + + if (funcnum=="1") { + if (param=="on ") { + term.formatPrintf("Led ACCESO \n",61,p52,99,1); //p52 + if (realExtraSerial==false) ardser.printf("\nLed ACCESO \n\r"); + printDisp(dispType,"Led ACCESO \n\r"); + led.onOff(1); //Accende il led + errp=0; + } + if (param=="off") { + term.formatPrintf("Led SPENTO! \n",61,p52,99,1); //p52 + if (realExtraSerial==false) ardser.printf("\nLed SPENTO! \n\r"); + printDisp(dispType,"Led SPENTO \n\r"); + led.onOff(0); //Spegne il led + errp=0; + } + } + return errp; +} + + +//********************** cambio menu + +bool funcfromMenu(string func, string funcnum, string param, string sstr) +{ +// funzione di load funzioni da menu scelto + bool errp=1; + char funcc; + char tempm; + int ccmenu=0; + int ccfun=0; + string funzionen; + funcc=*fnzAdd.string2char(fnzAdd.addEOS(funcnum)); + + //filtro vettore funzioni in base la menu + do { + // confronto il primo carattere dell vettore funzioni col primo carattere del menu + funzionen=menu_function[ccmenu]; + tempm=*fnzAdd.string2char(funzionen.substr(0,1)); + // se = metto il valore del vettore funzioni nel vettore funzioni scelte + if (tempm==funcc) { + menu_funcChoice[ccfun]=menu_function[ccmenu]; + ccfun++; + } + ccmenu++; + } while ((ccmenu<10) && (funcc!='z')) ; + funcidx=0; + //azzero da dove sono in giu' + for (int i = fnzAdd.c2i(funcc)+1; i <=funcidx ; i++) { + term.formatPrintf("\n",42,4+i,38); + } + //scrico dalla prima allo scelto + for (int i = 0; i <=fnzAdd.c2i(funcc) ; i++) { + term.formatPrintf(fnzAdd.string2char(menu_funcChoice[i]),42,4+i,38); + } + errp=0; //per ora non fa nulla, vedere se tenere a uso futuro + return errp; +} + + +bool menuOut(string func, string funcnum, string param, string sstr) +{ + bool errp=1; + char funcc; + funcc=*fnzAdd.string2char(fnzAdd.addEOS(funcnum)); + if ((funcnum>="0") && (funcnum<="9")) { + //azzero + term.formatPrintf(" \n",2,4+menuidx,1); + // scrivo + menuidx= fnzAdd.c2i(funcc); + term.formatPrintf("*\n",2,4+menuidx,1); + printDisp(dispType,fnzAdd.string2char(fnzAdd.addEOS("Menu "+funcnum+"\r"))); + //chiama la cernita delle funzioni + errp=funcfromMenu(func, funcnum, param, sstr); //ritorna sempre 0 (e va bene cosi) + } + return errp; +} + //************************ Random Out bool RfuncOut(string func, string funcnum, string param) @@ -32,8 +124,7 @@ printDisp(dispType,"Random On \n\r"); randomActivate=true; errp=0; - } - if (param=="off") { + } else if (param=="off") { term.formatPrintf("OFF\n",61,8,99,1); //p22 ardser.printf(fnzAdd.string2char(fnzAdd.addEOS("R10\r"))); printDisp(dispType,"Random OFF\n\r"); @@ -41,83 +132,17 @@ errp=0; } } - term.formatPrintf("\n",61,14,99,1); //p52 - return errp; -} - -//********************* Led -bool Lfunc(string func, string funcnum, string param) -{ - bool errp=1; - - if (funcnum=="1") { - if (param=="on ") { - term.formatPrintf("Led ACCESO \n",61,14,99,1); //p52 - if (realExtraSerial==false) ardser.printf("\nLed ACCESO \n\r"); - printDisp(dispType,"Led ACCESO \n\r"); - led.onOff(1); //Accende il led - errp=0; - } - if (param=="off") { - term.formatPrintf("Led SPENTO! \n",61,14,99,1); //p52 - if (realExtraSerial==false) ardser.printf("\nLed SPENTO! \n\r"); - printDisp(dispType,"Led SPENTO \n\r"); - led.onOff(0); //Spegne il led - errp=0; - } - } + term.formatPrintf("\n",61,p52,99,1); //p52 return errp; } -//********************* Synth Tracce -bool s09funcOut(string func, string funcnum, string param, char sstr) -{ - bool errp=1; - int funcn; - if ((funcnum>="0") && (funcnum<="9")) { - term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(func+"-"+funcnum+"-"+param)),21,14,8,1); //p51 - // vale la pena creare una funzione di parametri da formalizzare - funcn=fnzAdd.c2i(sstr); - funcn=fnzAdd.constrain(funcn,0,2); - term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(func+"-"+funcnum+"-"+param)),21+(funcn%2)*40,6+(2*(funcn/2)),8,1); //p11 //p12 //p21 - term.formatPrintf("Tracks Command \n",61,14,99,1); //p52 - ardser.printf(fnzAdd.string2char(fnzAdd.addEOS(func+funcnum+param+"\r"))); - printDisp(dispType,"Tracks Command \n\r"); - printDisp(dispType,fnzAdd.string2char(fnzAdd.addEOS(" "+func+funcnum+param+"\r"))); - //ardser.printf(fnzAdd.string2char(fnzAdd.addEOS(func+"-"+funcnum+"-"+param))); - errp=0; - } - return errp; -} - -//********************* Synth Note -bool NfuncOut(string func, string funcnum, string param, char* arr) -{ - bool errp=1; - int funcn; - - if ((funcnum>="0") && (funcnum<="9")) { - if (((arr[2]>='0') && (arr[2]<='9')) || (arr[2]=='-')) { - term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(func+"-"+funcnum+"-"+param)),21,14,8,1); //p51 - // vale la pena creare una funzione di parametri da formalizzare - funcn=fnzAdd.c2i(arr[2]); - //funcn=fnzAdd.constrain(funcn,0,2); - term.formatPrintf("Note Command \n",61,14,99,1); //p52 - ardser.printf(fnzAdd.string2char(fnzAdd.addEOS(func+funcnum+param+"\r"))); - printDisp(dispType,"Note Command \n\r"); - printDisp(dispType,fnzAdd.string2char(fnzAdd.addEOS(" "+func+funcnum+param+"\r"))); - errp=0; - } - } - return errp; -} //********************* Start bool StartfuncOut() { - term.formatPrintf("Start\n",21,14,8,1); //p51 - term.formatPrintf("Start H-Ard\n",61,14,99,1); //p52 + term.formatPrintf("Start\n",21,p51,8,1); //p51 + term.formatPrintf("Start H-Ard\n",61,p52,99,1); //p52 ardser.printf("start\r"); printDisp(dispType,"Start H-Ard\n\r"); return 0; @@ -126,83 +151,91 @@ //********************* Stop bool StopfuncOut() { - term.formatPrintf("Stop\n",21,14,8,1); //p51 - term.formatPrintf("Stop H-Ard\n",61,14,99,1); //p52 + term.formatPrintf("Stop\n",21,p51,8,1); //p51 + term.formatPrintf("Stop H-Ard\n",61,p52,99,1); //p52 ardser.printf("stop\r"); printDisp(dispType,"Stop H-Ard\n\r"); return 0; } -//********************* Delay Stop -bool DelayStopfuncOut() -{ - term.formatPrintf("DStop\n",21,14,8,1); //p51 - term.formatPrintf("Delay Stop H-Ard\n",61,14,99,1); //p52 - ardser.printf("dstop\r"); - printDisp(dispType,"DlyStop H-Ard\n\r"); - return 0; -} - - -/************************ IN Function *****************************/ +/************************ IN Function *****************************/ /******************************************************************/ /******************************************************************/ -//************************ Random - - -bool RfuncIn(string func, string funcnum, string param) +//********************* Menu In +bool menuIn(string func, string sstr) { bool errp=1; - if (funcnum=="1") { - if (param=="on ") { - printDisp(dispType,"Random On \n\r"); - term.formatPrintf("ON \n",65,8,99,1); //p22 - printDisp(dispType,"RfuncInOn \n\r"); - errp=0; - } - if (param=="off") { - term.formatPrintf("OFF\n",65,8,99,1); //p22 - printDisp(dispType,"RfuncInOFF\n\r"); - errp=0; - } + int funcn; + // char funcc=fnzAdd.string2char(sstr.substr(2,1)); + char funcc; + funcc=*fnzAdd.string2char(fnzAdd.addEOS(sstr.substr(2,1))); + if (funcc!='z') { + //trasformo in intero + funcn=fnzAdd.c2i(funcc); + //assegno menu al vettore + menu_main[funcn]=fnzAdd.addEOS(sstr); + //stampo in posizione + term.formatPrintf(fnzAdd.string2char(menu_main[funcn]),2,4+funcn,38); + //display + printDisp(dispType,"Menu In \n\r"); + printDisp(dispType,fnzAdd.string2char(fnzAdd.addEOS(" "+sstr.substr(0,3)+"\r"))); + errp=0; } return errp; } -//********************* Synth Tracce -bool s09funcIn(string func, string funcnum, string param, char sstr) +//********************* Function In +bool functionIn(string func, string sstr) { bool errp=1; int funcn; + char funcc= *fnzAdd.string2char(sstr.substr(2,1)); - if ((funcnum>="0") && (funcnum<="9")) { - term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(func+"-"+funcnum+"-"+param)),21,14,8,1); //p51 - // vale la pena creare una funzione di parametri da formalizzare - funcn=fnzAdd.c2i(sstr); - funcn=fnzAdd.constrain(funcn,0,2); - //azzera flag di ricezione - for (int i = 0; i < 3; i++) term.formatPrintf(" \n",31+(i%2)*40,6+(2*(i/2)),8,1); //p11 //p12 //p21 - term.formatPrintf("*\n",31+(funcn%2)*40,6+(2*(funcn/2)),8,1); //p11 //p12 //p21 - printDisp(dispType,"s09funcIn \n\r"); - printDisp(dispType,fnzAdd.string2char(fnzAdd.addEOS(" "+func+funcnum+param+"\r"))); + if (funcc!='z') { + //trasformo in intero + funcn=fnzAdd.c2i(funcc); + //assegno menu al vettore + menu_function[funcn]=fnzAdd.addEOS(sstr.substr(2,1)); //??? sicuri? + //display + printDisp(dispType,"Function In \n\r"); + printDisp(dispType,fnzAdd.string2char(fnzAdd.addEOS(" "+sstr.substr(0,3)+"\r"))); errp=0; } return errp; } +//********************* Start +bool StartfuncIn() +{ + term.formatPrintf("*\n",26,p51,8,1); //p51 + // term.formatPrintf("Start H-Ard\n",61,p52,99,1); //p52 + // printDisp(dispType,"InStart H-Ard\n\r"); + return 1; +} + +//********************* Start +bool StopfuncIn() +{ + term.formatPrintf("*\n",26,p51,8,1); //p51 + // term.formatPrintf("Start H-Ard\n",61,p52,99,1); //p52 +// printDisp(dispType,"InStop H-Ard\n\r"); + return 1; +} + + //********************* Synth Note bool NfuncIn(string func, string funcnum, string param, char* arr) { bool errp=1; int funcn; if ((funcnum>="0") && (funcnum<="9")) { - term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(param)),21,14,8,1); //p51 + term.formatPrintf(fnzAdd.string2char(fnzAdd.addEOS(param)),21,p51,8,1); //p51 // vale la pena creare una funzione di parametri da formalizzare funcn=fnzAdd.c2i(arr[2]+arr[3]); - for (int i = 0; i < 6; i++) term.formatPrintf(" ",23+(i*4),12,1,1); + for (int i = 0; i < 6; i++) term.formatPrintf(" ",23+(i*4),12,1,1); term.formatPrintf(fnzAdd.string2char(param.substr(0,2)+"*"),21+(fnzAdd.c2i(arr[1])*4),12,1,1); //p11 //p12 //p21 printDisp(dispType,"NFuncIn\n\r"); printDisp(dispType,fnzAdd.string2char(fnzAdd.addEOS(" "+func+funcnum+param+"\r"))); @@ -213,39 +246,12 @@ return errp; } -//********************* Start -bool StartfuncIn() -{ - term.formatPrintf("*\n",26,14,8,1); //p51 - // term.formatPrintf("Start H-Ard\n",61,14,99,1); //p52 - // printDisp(dispType,"InStart H-Ard\n\r"); - return 1; -} - -//********************* Start -bool StopfuncIn() -{ - term.formatPrintf("*\n",26,14,8,1); //p51 - // term.formatPrintf("Start H-Ard\n",61,14,99,1); //p52 - // printDisp(dispType,"InStop H-Ard\n\r"); - return 1; -} - -//********************* Start -bool DelayStopfuncIn() -{ - term.formatPrintf("*\n",26,14,8,1); //p51 - // term.formatPrintf("Start H-Ard\n",61,14,99,1); //p52 - // printDisp(dispType,"InStop H-Ard\n\r"); - return 1; -} - -//********************* Start +//********************* Boot bool bootfuncIn() { - term.formatPrintf("*\n",26,14,8,1); //p51 - term.formatPrintf("boot\n",21,14,8,1); //p51 - term.formatPrintf("Arduino Boot\n",61,14,99,1); //p52 + term.formatPrintf("*\n",26,p51,8,1); //p51 + term.formatPrintf("boot\n",21,p51,8,1); //p51 + term.formatPrintf("Arduino Boot\n",61,p52,99,1); //p52 ardser.printf("rl\r"); return 1; } \ No newline at end of file
--- a/main.cpp Fri Nov 06 22:31:17 2015 +0000 +++ b/main.cpp Thu Dec 24 01:38:56 2015 +0000 @@ -9,7 +9,8 @@ Terminal term(USBTX, USBRX); // tx, rx BufferedSerial pc(SERIAL_TX, SERIAL_RX); //Apertura della seriale 2 -BufferedSerial ardser(PA_11, PA_12); //Apertura della seriale 1 *opzionale vedi sotto +// originale!!!!!!!!! BufferedSerial ardser(PA_11, PA_12); //Apertura della seriale 1 *opzionale vedi sotto +BufferedSerial ardser(PC_4, PC_5); //init funzioni personal lib Flasher led(LED1); Screen sc(&pc); @@ -23,6 +24,16 @@ bool realExtraSerial=true; //se true manda fuori solo le info reali senno demo bool randomActivate=true; //se true attiva sul sequencer il cambio di note casuali +string menu_main[10]; +string menu_funcChoice[10]; +string menu_function[99]; +int menuidx=0; +int funcidx=0; + +//---------- extern +// dichiarando qui le variabili extern, posso inizializzarle in qualunque parte del programma. In teoria parrebbe inutile ma in questo modo posso un domani istanziarle ovunque +extern int p01,p02,p03; +extern int p51, p52; //------------ Funzioni ------------- #include "macroDisp.h" @@ -70,7 +81,6 @@ buffer[0][i[0]]=0; //se è un CR inserisci un carattere nullo nel buffer per delimitare la stringa //controlla di non mandare solo un CR if (i[0]>0) { - // if (realExtraSerial==false) ardser.printf("cmd Ready\n\r"); for(int ii=0; ii<=i[0]; ii++) bufferTemp[ii]=buffer[0][ii]; parserVT100(bufferTemp); } else term.readypos(); @@ -81,7 +91,7 @@ //seriale esterna if (ardser.readable()) { c[1]=ardser.getc(); //legge un carattere dalla seriale - if ((c[1] != 10) && (c[1] != 13)) { + if ((c[1] != 10) && (c[1] != 13)) { buffer[1][i[1]]=c[1]; // se il carattere è diverso da CarriageReturn (ASCII 13) lo memorizza nel buffer i[1]++; // incrementa il puntatore al buffer } else {