Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: src/menu.cpp
- Revision:
- 16:5791665200cb
- Parent:
- 15:aed8f326c949
- Child:
- 18:78e982f31c6b
--- a/src/menu.cpp Tue Dec 11 16:59:21 2018 +0000
+++ b/src/menu.cpp Wed Dec 12 00:10:03 2018 +0000
@@ -57,55 +57,66 @@
*******************************************************************************/
void refreshStatus(struct statusValues statVals){
+ char strbuf_mode[15] = {0};
+ char strbuf_running[16] = {0};
+ char strbuf_v48[15] = {0};
+ char strbuf_v24[15] = {0};
+ char strbuf_v12[15] = {0};
+ char strbuf_blank[50] = {0};
+
if(buck){
- sprintf(strbuf, "Buck Mode | ");
+ sprintf(strbuf_mode, "Buck Mode | ");
}else{
- sprintf(strbuf, "Boost Mode | ");
+ sprintf(strbuf_mode, "Boost Mode | ");
}
- sendSerial(strbuf);
+ //sendSerial(strbuf);
+
+ if(running){
+ sprintf(strbuf_running, "Running | ");
+ }else{
+ sprintf(strbuf_running, "NOT Running | ");
+ }
+ //sendSerial(strbuf);
if(statVals.V48_IS_HI){
- sprintf(strbuf, "V48 HIGH | ");
- sendSerial(strbuf);
+ sprintf(strbuf_v48, "V48 HIGH | ");
}else if(statVals.V48_IS_LO){
- sprintf(strbuf, "V48 LOW | ");
- sendSerial(strbuf);
+ sprintf(strbuf_v48, "V48 LOW | ");
}else{
- sprintf(strbuf, "V48 OK | ");
- sendSerial(strbuf);
+ // sprintf(strbuf, "V48 OK | ");
+ sprintf(strbuf_v48, "");
+ sprintf(strbuf_blank, " ");
}
+ //sendSerial(strbuf);
if(statVals.V24_IS_HI){
- sprintf(strbuf, "V24 HIGH | ");
- sendSerial(strbuf);
+ sprintf(strbuf_v24, "V24 HIGH | ");
}else if(statVals.V24_IS_LO){
- sprintf(strbuf, "V24 LOW | ");
- sendSerial(strbuf);
+ sprintf(strbuf_v24, "V24 LOW | ");
}else{
- sprintf(strbuf, "V24 OK | ");
- sendSerial(strbuf);
+ // sprintf(strbuf, "V24 OK | ");
+ sprintf(strbuf_v24, "");
+ sprintf(strbuf_blank, strcat(strbuf_blank, " "));
}
+ //sendSerial(strbuf);
if(statVals.V12_IS_HI){
- sprintf(strbuf, "V12 HIGH | ");
- sendSerial(strbuf);
+ sprintf(strbuf_v12, "V12 HIGH ");
}else if(statVals.V24_IS_LO){
- sprintf(strbuf, "V12 LOW | ");
- sendSerial(strbuf);
+ sprintf(strbuf_v12, "V12 LOW ");
}else{
- sprintf(strbuf, "V12 OK | ");
- sendSerial(strbuf);
+ // sprintf(strbuf, "V12 OK | ");
+ sprintf(strbuf_v12, "");
+ sprintf(strbuf_blank, strcat(strbuf_blank, " "));
}
+ //sendSerial(strbuf);
- if(running){
- sprintf(strbuf, "Running ");
- sendSerial(strbuf);
- }else{
- sprintf(strbuf, "NOT Running");
- sendSerial(strbuf);
- }
+ //move cursor to STATUS_ROW and write status info
+ //char row = STATUS_ROW + '0';
+ sprintf( strbuf, "%c[9;0f", 27); // ESC=27, Move cursor position = [line;columnf
+ sendSerial(strbuf);
- sprintf(strbuf, "\r\n");
+ sprintf(strbuf, "Status: %s%s%s%s%s%s\r\n\r\n", strbuf_mode, strbuf_running, strbuf_v48, strbuf_v24, strbuf_v12, strbuf_blank);
sendSerial(strbuf);
}
@@ -123,6 +134,11 @@
double pwr_in=dvals.v48f*(dvals.i48f);
double pwr_eff=100*pwr_out/pwr_in;
+ //move cursor to DATA_ROW and write data
+ //row = DATA_ROW + '0';
+ sprintf( strbuf, "%c[10;0f", 27); // ESC=27, Move cursor position = [line;columnf
+ sendSerial(strbuf);
+
sprintf(strbuf, "V48=%2.1f, I48=%3.1f | V24=%2.1f, I24=%3.1f | V12=%2.1f, I12=%3.1f \r\n", dvals.v48f, dvals.i48f, dvals.v24f, dvals.i24f, dvals.v12f, dvals.i12f);
//sprintf(strbuf, "V48=%2.1f, I48=%2.2f | V24=%2.1f, I24=%2.2f | V12=%2.1f, I12=%2.2f || loop=%d \r\n", v48f, i48f, v24f, i24f, v12f, i12f, loopTime);
sendSerial(strbuf);
@@ -134,7 +150,7 @@
sendSerial(strbuf);
sprintf( strbuf, "%c[30m", 27 ); // ESC=27, White Text
sendSerial(strbuf);
- sprintf(strbuf, "wr_out_code=%d, en_out_code=%d ", wr_out_code, en_out_code);
+ sprintf(strbuf, "wr_out_code=%d, en_out_code=%d \r\n", wr_out_code, en_out_code);
sendSerial(strbuf);
}
@@ -146,16 +162,7 @@
sprintf( strbuf, "%c7", 27 ); // ESC=27, Save cursor position = [s
sendSerial(strbuf);
- //move cursor to STATUS_ROW and write status info
- char row = STATUS_ROW + '0';
- sprintf( strbuf, "%c[%c;0f", 27, row); // ESC=27, Move cursor position = [line;columnf
- sendSerial(strbuf);
refreshStatus(statVals);
-
- //move cursor to DATA_ROW and write data
- row = DATA_ROW + '0';
- sprintf( strbuf, "%c[%c;0f", 27, row); // ESC=27, Move cursor position = [line;columnf
- sendSerial(strbuf);
refreshData(adcVals);
//move cursor to CUR_POS
@@ -180,11 +187,12 @@
// clears terminal and re-draws main menu
void menuRedraw(bool prompt){
clrScrn();
+ menu_banner();
sprintf( strbuf, "%c[34m", 27 ); // ESC=27, Blue Text
sendSerial(strbuf);
- sprintf(strbuf, " Agility Power Systems DCM1 0.6\r\n\r\n");
+ sprintf(strbuf, " Agility Power Systems DCM1 0.7\r\n\r\n");
sendSerial(strbuf);
sprintf( strbuf, "%c[0m", 27 ); // ESC=27, Normal
@@ -197,15 +205,25 @@
refreshStatus(statVals);
refreshData(adcVals);
+ sprintf(strbuf, "\r\nCommands: (Not Case-Sensitive)");
+ sendSerial(strbuf);
sprintf(strbuf, "\r\n BRDS");
sendSerial(strbuf);
sprintf(strbuf, "\r\n MULT");
sendSerial(strbuf);
sprintf(strbuf, "\r\n ALLOFF");
sendSerial(strbuf);
- sprintf(strbuf, "\r\n RUN [xx]");
+ sprintf(strbuf, "\r\n RUN");
+ sendSerial(strbuf);
+ sprintf(strbuf, "\r\n STOP\r\n");
+ sendSerial(strbuf);
+ sprintf(strbuf, "\r\n Type \'=number\' after BRDS or MULT to enter value.");
sendSerial(strbuf);
- sprintf(strbuf, "\r\n STOP");
+ sprintf(strbuf, "\r\n e.g. BRDS=8191 will enable all boards.\r\n");
+ sendSerial(strbuf);
+ sprintf(strbuf, "\r\n Type \'?\' at end of BRDS or MULT to get status.");
+ sendSerial(strbuf);
+ sprintf(strbuf, "\r\n e.g. BRDS? will print value of BRDS.\r\n");
sendSerial(strbuf);
if(prompt){
@@ -252,7 +270,7 @@
}
}
-void splash_screen(void)
+void menu_banner(void)
{
clrScrn();
sprintf(strbuf," ___ _ ___ __ ____ _____ __ \r\n");sendSerial(strbuf);