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
Revision 16:5791665200cb, committed 2018-12-12
- Comitter:
- mfwic
- Date:
- Wed Dec 12 00:10:03 2018 +0000
- Parent:
- 15:aed8f326c949
- Child:
- 17:454afe56eedb
- Commit message:
- Added banner and fixed status display to clear old status properly.
Changed in this revision
--- a/inc/globals.h Tue Dec 11 16:59:21 2018 +0000 +++ b/inc/globals.h Wed Dec 12 00:10:03 2018 +0000 @@ -51,8 +51,8 @@ #define UPDATE_REFRESH_DELAY_US 500000.0 const unsigned int LOOP_COUNTER = 500000.0/500; -#define STATUS_ROW 3 -#define DATA_ROW STATUS_ROW+1 +//#define STATUS_ROW 8 +//#define DATA_ROW STATUS_ROW+1 #define BOARD_ENABLE_DELAY_MS 50
--- a/inc/menu.h Tue Dec 11 16:59:21 2018 +0000 +++ b/inc/menu.h Wed Dec 12 00:10:03 2018 +0000 @@ -49,6 +49,6 @@ void menuRedraw(bool); void menuPrompt(int); -void splash_screen(void); +void menu_banner(void); #endif \ No newline at end of file
--- a/inc/serial.h Tue Dec 11 16:59:21 2018 +0000 +++ b/inc/serial.h Wed Dec 12 00:10:03 2018 +0000 @@ -17,7 +17,7 @@ unsigned int spare:12; }; -extern char strbuf[100]; +extern char strbuf[150]; extern char rxbuf[MAXRXBUF+1]; extern volatile unsigned int bufloc; extern Serial pc;
--- a/src/command.cpp Tue Dec 11 16:59:21 2018 +0000 +++ b/src/command.cpp Wed Dec 12 00:10:03 2018 +0000 @@ -39,8 +39,8 @@ #include "menu.h" #include "command.h" -unsigned int boardsActive; -unsigned int boardMults; +unsigned int boardsActive = 1; +unsigned int boardMults = 1; unsigned int commandData; extern unsigned short my12;
--- a/src/main.cpp Tue Dec 11 16:59:21 2018 +0000
+++ b/src/main.cpp Wed Dec 12 00:10:03 2018 +0000
@@ -68,7 +68,7 @@
struct adcValues adcVals = getADCresults();
struct statusValues statVals = checkLevels(adcVals);
- splash_screen();
+ menu_banner();
//initBoards(adcVals);
sprintf(strbuf, "\r\nPress Enter to continue");
sendSerial(strbuf);
--- 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);
--- a/src/serial.cpp Tue Dec 11 16:59:21 2018 +0000
+++ b/src/serial.cpp Wed Dec 12 00:10:03 2018 +0000
@@ -7,7 +7,7 @@
/************* GLOBAL VARIABLES *****************************/
struct serialStatusBits serialStatus;
-char strbuf[100] = {0};
+char strbuf[150] = {0};
char rxbuf[MAXRXBUF+1] = {0};
volatile unsigned int bufloc = 0;