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:
- 8:d3d7dca419b3
- Parent:
- 7:860b3a8275cb
- Child:
- 9:816b9a4e4f21
--- a/src/menu.cpp Wed Dec 05 00:20:34 2018 +0000
+++ b/src/menu.cpp Thu Dec 06 16:22:11 2018 +0000
@@ -53,31 +53,48 @@
refreshData - Refresh voltage and current readings to the terminal
*******************************************************************************/
void refreshData(void){
- loopTime = masterTimer.read_ms() - oldTime;
- oldTime = masterTimer.read_ms();
+ //loopTime = masterTimer.read_ms() - oldTime;
+ //oldTime = masterTimer.read_ms();
+
+ double v48f = 0.0;
+ double v24f = 0.0;
+ double v12f = 0.0;
+ double i48f = 0.0;
+ double i24f = 0.0;
+ double i12f = 0.0;
- double v48f = 48*(v48/2048);
- double v24f = 24*(v48/2048);
- double v12f = 12*(v48/2048);
- double i48f = i48/40;
- double i24f = i24/40;
- double i12f = i12/40;
+ if(!raw){
+ v48f = VOLTAGE_48_FACTOR*v48;
+ v24f = VOLTAGE_24_FACTOR*v24;
+ v12f = VOLTAGE_12_FACTOR*v12;
+ i48f = (i48-CURRENT_48_OFFSET)/CURRENT_48_DIV_FACTOR;
+ i24f = (i24-CURRENT_24_OFFSET)/CURRENT_24_DIV_FACTOR;
+ i12f = (i12-CURRENT_12_OFFSET)/CURRENT_12_DIV_FACTOR;
+ }else{
+ v48f = 1.0*v48;
+ v24f = 1.0*v24;
+ v12f = 1.0*v12;
+ i48f = 1.0*i48;
+ i24f = 1.0*i24;
+ i12f = 1.0*i12;
+ }
double pwr_out=v12f*i12f;
- double pwr_in=v48f*(i48f-0.25);
+ double pwr_in=v48f*(i48f-CURRENT_CONTROL_OFFSET);
double pwr_eff=100*pwr_out/pwr_in;
- sprintf(strbuf, "V48=%2.2f, I48=%2.2f | V24=%2.2f, I24=%2.2f | V12=%2.2f, I12=%2.2f || loop=%d \r\n", v48f, i48f, v24f, i24f, v12f, i12f, loopTime);
+ sprintf(strbuf, "V48=%2.1f, I48=%3.1f | V24=%2.1f, I24=%3.1f | V12=%2.1f, I12=%3.1f \r\n", v48f, i48f, v24f, i24f, v12f, 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);
- sprintf(strbuf, "Power Out = %4.1f W, Power In = %4.1f W, ", pwr_out, pwr_in);
+ sprintf(strbuf, "Power Out = %4.1f W, Power In = %4.1f W \r\n", pwr_out, pwr_in);
sendSerial(strbuf);
sprintf( strbuf, "%c[34m", 27 ); // ESC=27, Blue Text
sendSerial(strbuf);
- sprintf(strbuf, "Power Efficiency = %2.2f percent\r\n", pwr_eff);
+ sprintf(strbuf, "Power Efficiency = %2.2f percent \r\n\r\n", pwr_eff);
sendSerial(strbuf);
sprintf( strbuf, "%c[30m", 27 ); // ESC=27, White Text
sendSerial(strbuf);
//sprintf(strbuf, "thermCode=%d, binCode=%d", thermCode[17], binCode[6]);
- 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 ", wr_out_code, en_out_code);
sendSerial(strbuf);
}
@@ -89,7 +106,7 @@
sprintf( strbuf, "%c7", 27 ); // ESC=27, Save cursor position = [s
sendSerial(strbuf);
//move cursor to DATA_ROW
- sprintf( strbuf, "%c[2;0f", 27 ); // ESC=27, Move cursor position = [line;columnf
+ sprintf( strbuf, "%c[3;0f", 27 ); // ESC=27, Move cursor position = [line;columnf
sendSerial(strbuf);
//write data
refreshData();
@@ -113,13 +130,13 @@
menuRedraw - Write menu to terminal
*******************************************************************************/
// clears terminal and re-draws main menu
-void menuRedraw(void){
+void menuRedraw(bool prompt){
clrScrn();
sprintf( strbuf, "%c[34m", 27 ); // ESC=27, Blue Text
sendSerial(strbuf);
- sprintf(strbuf, "Agility Power Systems DCM1 Menu 0.35\r\n");
+ sprintf(strbuf, " Agility Power Systems DCM1 0.4\r\n\r\n");
sendSerial(strbuf);
sprintf( strbuf, "%c[0m", 27 ); // ESC=27, Normal
@@ -129,18 +146,20 @@
refreshData();
- sprintf(strbuf, "\r\nMULT");
+ sprintf(strbuf, "\r\n MULT");
sendSerial(strbuf);
- sprintf(strbuf, "\r\nBRDS");
+ sprintf(strbuf, "\r\n BRDS");
sendSerial(strbuf);
- sprintf(strbuf, "\r\nALLOFF");
+ sprintf(strbuf, "\r\n ALLOFF");
sendSerial(strbuf);
- sprintf(strbuf, "\r\nRUN [xx]");
+ sprintf(strbuf, "\r\n RUN [xx]");
sendSerial(strbuf);
- sprintf(strbuf, "\r\nSTOP");
+ sprintf(strbuf, "\r\n STOP");
sendSerial(strbuf);
- menuPrompt(MENU_DCM1);
+ if(prompt){
+ menuPrompt(MENU_DCM1);
+ }
}
/*******************************************************************************
@@ -180,4 +199,23 @@
sendSerial(strbuf);
// sendSerial("\n\r>");
}
-}
\ No newline at end of file
+}
+
+void splash_screen(void)
+{
+ clrScrn();
+ sprintf(strbuf," ___ _ ___ __ ____ _____ __ \r\n");sendSerial(strbuf);
+ sprintf(strbuf," / | ____ _(_) (_) /___ __ / __ \\____ _ _____ _____ / ___/__ _______/ /____ ____ ___ _____\r\n");sendSerial(strbuf);
+ sprintf(strbuf," / /| |/ __ `/ / / / __/ / / / / /_/ / __ \\ | /| / / _ \\/ ___/ \\__ \\/ / / / ___/ __/ _ \\/ __ `__ \\/ ___/\r\n");sendSerial(strbuf);
+ sprintf(strbuf," / ___ / /_/ / / / / /_/ /_/ / / ____/ /_/ / |/ |/ / __/ / ___/ / /_/ (__ ) /_/ __/ / / / / (__ ) \r\n");sendSerial(strbuf);
+ sprintf(strbuf,"/_/ |_\\__, /_/_/_/\\__/\\__, / /_/ \\____/|__/|__/\\___/_/ /____/\\__, /____/\\__/\\___/_/ /_/ /_/____/ \r\n");sendSerial(strbuf);
+ sprintf(strbuf," /____/ /____/ /____/ \r\n");sendSerial(strbuf);
+}
+/*
+ sprintf(strbuf," ___ _ ___ __ ____ _____ __ \r\n");
+ sprintf(strbuf," / | ____ _(_) (_) /___ __ / __ \____ _ _____ _____ / ___/__ _______/ /____ ____ ___ _____\r\n");
+ sprintf(strbuf," / /| |/ __ `/ / / / __/ / / / / /_/ / __ \ | /| / / _ \/ ___/ \__ \/ / / / ___/ __/ _ \/ __ `__ \/ ___/\r\n");
+ sprintf(strbuf," / ___ / /_/ / / / / /_/ /_/ / / ____/ /_/ / |/ |/ / __/ / ___/ / /_/ (__ ) /_/ __/ / / / / (__ ) \r\n");
+ sprintf(strbuf,"/_/ |_\__, /_/_/_/\__/\__, / /_/ \____/|__/|__/\___/_/ /____/\__, /____/\__/\___/_/ /_/ /_/____/ \r\n");
+ sprintf(strbuf," /____/ /____/ /____/ \r\n");
+*/
\ No newline at end of file