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
src/menu.cpp@0:b3410a1e9843, 2022-01-27 (annotated)
- Committer:
- Slord2142
- Date:
- Thu Jan 27 21:58:14 2022 +0000
- Revision:
- 0:b3410a1e9843
- Child:
- 1:bc3509459a27
This is the newest version I am playing around with
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Slord2142 | 0:b3410a1e9843 | 1 | //------------------------------------------------------------------------------- |
Slord2142 | 0:b3410a1e9843 | 2 | // |
Slord2142 | 0:b3410a1e9843 | 3 | // Treehouse Inc. |
Slord2142 | 0:b3410a1e9843 | 4 | // Colorado Springs, Colorado |
Slord2142 | 0:b3410a1e9843 | 5 | // |
Slord2142 | 0:b3410a1e9843 | 6 | // Copyright (c) 2016 by Treehouse Designs Inc. |
Slord2142 | 0:b3410a1e9843 | 7 | // |
Slord2142 | 0:b3410a1e9843 | 8 | // This code is the property of Treehouse, Inc. (Treehouse) and may not be redistributed |
Slord2142 | 0:b3410a1e9843 | 9 | // in any form without prior written permission from the copyright holder, Treehouse. |
Slord2142 | 0:b3410a1e9843 | 10 | // |
Slord2142 | 0:b3410a1e9843 | 11 | // The above copyright notice and this permission notice shall be included in |
Slord2142 | 0:b3410a1e9843 | 12 | // all copies or substantial portions of the Software. |
Slord2142 | 0:b3410a1e9843 | 13 | // |
Slord2142 | 0:b3410a1e9843 | 14 | //------------------------------------------------------------------------------- |
Slord2142 | 0:b3410a1e9843 | 15 | // |
Slord2142 | 0:b3410a1e9843 | 16 | // REVISION HISTORY: |
Slord2142 | 0:b3410a1e9843 | 17 | // |
Slord2142 | 0:b3410a1e9843 | 18 | // $Author: $ |
Slord2142 | 0:b3410a1e9843 | 19 | // $Rev: $ |
Slord2142 | 0:b3410a1e9843 | 20 | // $Date: $ |
Slord2142 | 0:b3410a1e9843 | 21 | // $URL: $ |
Slord2142 | 0:b3410a1e9843 | 22 | // |
Slord2142 | 0:b3410a1e9843 | 23 | //------------------------------------------------------------------------------- |
Slord2142 | 0:b3410a1e9843 | 24 | |
Slord2142 | 0:b3410a1e9843 | 25 | #include "mbed.h" |
Slord2142 | 0:b3410a1e9843 | 26 | #include "globals.h" |
Slord2142 | 0:b3410a1e9843 | 27 | #include "serial.h" |
Slord2142 | 0:b3410a1e9843 | 28 | #include "menu.h" |
Slord2142 | 0:b3410a1e9843 | 29 | #include "adc.h" |
Slord2142 | 0:b3410a1e9843 | 30 | #include "boards.h" |
Slord2142 | 0:b3410a1e9843 | 31 | #include "Ticker.h" |
Slord2142 | 0:b3410a1e9843 | 32 | #include "stdlib.h" |
Slord2142 | 0:b3410a1e9843 | 33 | #include "lut.h" |
Slord2142 | 0:b3410a1e9843 | 34 | #include "temp.h" |
Slord2142 | 0:b3410a1e9843 | 35 | |
Slord2142 | 0:b3410a1e9843 | 36 | Ticker drt; |
Slord2142 | 0:b3410a1e9843 | 37 | unsigned int oldTime=0; |
Slord2142 | 0:b3410a1e9843 | 38 | |
Slord2142 | 0:b3410a1e9843 | 39 | /******************************************************************************* |
Slord2142 | 0:b3410a1e9843 | 40 | drtInt - Display Refresh Timer interrupt handler |
Slord2142 | 0:b3410a1e9843 | 41 | *******************************************************************************/ |
Slord2142 | 0:b3410a1e9843 | 42 | // real time clock interrupt to flash the LED |
Slord2142 | 0:b3410a1e9843 | 43 | void drtInt(void) |
Slord2142 | 0:b3410a1e9843 | 44 | { |
Slord2142 | 0:b3410a1e9843 | 45 | updateReady = TRUE; |
Slord2142 | 0:b3410a1e9843 | 46 | } |
Slord2142 | 0:b3410a1e9843 | 47 | |
Slord2142 | 0:b3410a1e9843 | 48 | /******************************************************************************* |
Slord2142 | 0:b3410a1e9843 | 49 | initDRT - Create Display Refresh Timer interrupt |
Slord2142 | 0:b3410a1e9843 | 50 | *******************************************************************************/ |
Slord2142 | 0:b3410a1e9843 | 51 | // initialize display refresh timer (DRT) |
Slord2142 | 0:b3410a1e9843 | 52 | void initDRT(void) |
Slord2142 | 0:b3410a1e9843 | 53 | { |
Slord2142 | 0:b3410a1e9843 | 54 | drt.attach_us(&drtInt, UPDATE_REFRESH_DELAY_US); |
Slord2142 | 0:b3410a1e9843 | 55 | } |
Slord2142 | 0:b3410a1e9843 | 56 | |
Slord2142 | 0:b3410a1e9843 | 57 | /******************************************************************************* |
Slord2142 | 0:b3410a1e9843 | 58 | refreshStatus - Refresh status info to the terminal |
Slord2142 | 0:b3410a1e9843 | 59 | *******************************************************************************/ |
Slord2142 | 0:b3410a1e9843 | 60 | void refreshStatus(struct statusValues statVals){ |
Slord2142 | 0:b3410a1e9843 | 61 | |
Slord2142 | 0:b3410a1e9843 | 62 | char strbuf_mode[15] = {0}; |
Slord2142 | 0:b3410a1e9843 | 63 | char strbuf_running[16] = {0}; |
Slord2142 | 0:b3410a1e9843 | 64 | char strbuf_v48[15] = {0}; |
Slord2142 | 0:b3410a1e9843 | 65 | char strbuf_v24[15] = {0}; |
Slord2142 | 0:b3410a1e9843 | 66 | char strbuf_v12[15] = {0}; |
Slord2142 | 0:b3410a1e9843 | 67 | char strbuf_blank[50] = {0}; |
Slord2142 | 0:b3410a1e9843 | 68 | |
Slord2142 | 0:b3410a1e9843 | 69 | if(buck){ |
Slord2142 | 0:b3410a1e9843 | 70 | sprintf(strbuf_mode, "Buck Mode | "); |
Slord2142 | 0:b3410a1e9843 | 71 | }else{ |
Slord2142 | 0:b3410a1e9843 | 72 | sprintf(strbuf_mode, "Boost Mode | "); |
Slord2142 | 0:b3410a1e9843 | 73 | } |
Slord2142 | 0:b3410a1e9843 | 74 | //sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 75 | |
Slord2142 | 0:b3410a1e9843 | 76 | if(running){ |
Slord2142 | 0:b3410a1e9843 | 77 | sprintf(strbuf_running, "Running | "); |
Slord2142 | 0:b3410a1e9843 | 78 | }else{ |
Slord2142 | 0:b3410a1e9843 | 79 | sprintf(strbuf_running, "NOT Running | "); |
Slord2142 | 0:b3410a1e9843 | 80 | } |
Slord2142 | 0:b3410a1e9843 | 81 | //sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 82 | |
Slord2142 | 0:b3410a1e9843 | 83 | if(statVals.V48_IS_HI){ |
Slord2142 | 0:b3410a1e9843 | 84 | sprintf(strbuf_v48, "V48 HIGH | "); |
Slord2142 | 0:b3410a1e9843 | 85 | }else if(statVals.V48_IS_LO){ |
Slord2142 | 0:b3410a1e9843 | 86 | sprintf(strbuf_v48, "V48 LOW | "); |
Slord2142 | 0:b3410a1e9843 | 87 | }else{ |
Slord2142 | 0:b3410a1e9843 | 88 | // sprintf(strbuf, "V48 OK | "); |
Slord2142 | 0:b3410a1e9843 | 89 | sprintf(strbuf_v48, ""); |
Slord2142 | 0:b3410a1e9843 | 90 | sprintf(strbuf_blank, " "); |
Slord2142 | 0:b3410a1e9843 | 91 | } |
Slord2142 | 0:b3410a1e9843 | 92 | //sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 93 | /* |
Slord2142 | 0:b3410a1e9843 | 94 | if(statVals.V24_IS_HI){ |
Slord2142 | 0:b3410a1e9843 | 95 | sprintf(strbuf_v24, "V24 HIGH | "); |
Slord2142 | 0:b3410a1e9843 | 96 | }else if(statVals.V24_IS_LO){ |
Slord2142 | 0:b3410a1e9843 | 97 | sprintf(strbuf_v24, "V24 LOW | "); |
Slord2142 | 0:b3410a1e9843 | 98 | }else{ |
Slord2142 | 0:b3410a1e9843 | 99 | // sprintf(strbuf, "V24 OK | "); |
Slord2142 | 0:b3410a1e9843 | 100 | sprintf(strbuf_v24, ""); |
Slord2142 | 0:b3410a1e9843 | 101 | sprintf(strbuf_blank, strcat(strbuf_blank, " ")); |
Slord2142 | 0:b3410a1e9843 | 102 | } |
Slord2142 | 0:b3410a1e9843 | 103 | //sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 104 | |
Slord2142 | 0:b3410a1e9843 | 105 | if(statVals.V12_IS_HI){ |
Slord2142 | 0:b3410a1e9843 | 106 | sprintf(strbuf_v12, "V12 HIGH "); |
Slord2142 | 0:b3410a1e9843 | 107 | }else if(statVals.V24_IS_LO){ |
Slord2142 | 0:b3410a1e9843 | 108 | sprintf(strbuf_v12, "V12 LOW "); |
Slord2142 | 0:b3410a1e9843 | 109 | }else{ |
Slord2142 | 0:b3410a1e9843 | 110 | // sprintf(strbuf, "V12 OK | "); |
Slord2142 | 0:b3410a1e9843 | 111 | sprintf(strbuf_v12, ""); |
Slord2142 | 0:b3410a1e9843 | 112 | sprintf(strbuf_blank, strcat(strbuf_blank, " ")); |
Slord2142 | 0:b3410a1e9843 | 113 | }*/ |
Slord2142 | 0:b3410a1e9843 | 114 | //sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 115 | |
Slord2142 | 0:b3410a1e9843 | 116 | //move cursor to STATUS_ROW and write status info |
Slord2142 | 0:b3410a1e9843 | 117 | //char row = STATUS_ROW + '0'; |
Slord2142 | 0:b3410a1e9843 | 118 | sprintf( strbuf, "%c[9;0f", 27); // ESC=27, Move cursor position = [line;columnf |
Slord2142 | 0:b3410a1e9843 | 119 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 120 | |
Slord2142 | 0:b3410a1e9843 | 121 | 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); |
Slord2142 | 0:b3410a1e9843 | 122 | //sprintf(strbuf, "Status: %s%s%s%s%s%d \r\n\r\n", strbuf_mode, strbuf_running, strbuf_v48, strbuf_v24, strbuf_v12, row_print); |
Slord2142 | 0:b3410a1e9843 | 123 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 124 | |
Slord2142 | 0:b3410a1e9843 | 125 | } |
Slord2142 | 0:b3410a1e9843 | 126 | |
Slord2142 | 0:b3410a1e9843 | 127 | /******************************************************************************* |
Slord2142 | 0:b3410a1e9843 | 128 | refreshData - Refresh voltage and current readings to the terminal |
Slord2142 | 0:b3410a1e9843 | 129 | *******************************************************************************/ |
Slord2142 | 0:b3410a1e9843 | 130 | void refreshData(struct adcValues adcVals){ |
Slord2142 | 0:b3410a1e9843 | 131 | //loopTime = masterTimer.read_ms() - oldTime; |
Slord2142 | 0:b3410a1e9843 | 132 | //oldTime = masterTimer.read_ms(); |
Slord2142 | 0:b3410a1e9843 | 133 | |
Slord2142 | 0:b3410a1e9843 | 134 | struct displayValues dvals = calcDisplayValues(adcVals); |
Slord2142 | 0:b3410a1e9843 | 135 | |
Slord2142 | 0:b3410a1e9843 | 136 | double pwr_out=dvals.v12f*dvals.i12f; |
Slord2142 | 0:b3410a1e9843 | 137 | //double pwr_in=dvals.v48f*(dvals.i48f); |
Slord2142 | 0:b3410a1e9843 | 138 | //double pwr_eff=100*pwr_out/pwr_in; |
Slord2142 | 0:b3410a1e9843 | 139 | |
Slord2142 | 0:b3410a1e9843 | 140 | //move cursor to DATA_ROW and write data |
Slord2142 | 0:b3410a1e9843 | 141 | //row = DATA_ROW + '0'; |
Slord2142 | 0:b3410a1e9843 | 142 | sprintf( strbuf, "%c[10;0f", 27); // ESC=27, Move cursor position = [line;columnf |
Slord2142 | 0:b3410a1e9843 | 143 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 144 | float temp_reading = GetTemperature(); |
Slord2142 | 0:b3410a1e9843 | 145 | |
Slord2142 | 0:b3410a1e9843 | 146 | sprintf(strbuf, "V48=%2.1f | V12=%2.1f, I12=%3.2f | Temp=%f | Test=%2.1f \r\n", dvals.v48f, dvals.v12f, dvals.i12f, temp_reading, dvals.test_v); |
Slord2142 | 0:b3410a1e9843 | 147 | //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); |
Slord2142 | 0:b3410a1e9843 | 148 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 149 | //sprintf(strbuf, "adcVals.i12 = %d \r\n", adcVals.i12); |
Slord2142 | 0:b3410a1e9843 | 150 | //sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 151 | //sprintf(strbuf, "Power Out = %4.1f W, Power In = %4.1f W \r\n", pwr_out, pwr_in); |
Slord2142 | 0:b3410a1e9843 | 152 | //sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 153 | sprintf( strbuf, "%c[34m", 27 ); // ESC=27, Blue Text |
Slord2142 | 0:b3410a1e9843 | 154 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 155 | //sprintf(strbuf, "Power Efficiency = %2.2f percent \r\n\r\n", pwr_eff); |
Slord2142 | 0:b3410a1e9843 | 156 | //sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 157 | sprintf( strbuf, "%c[30m", 27 ); // ESC=27, White Text |
Slord2142 | 0:b3410a1e9843 | 158 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 159 | sprintf(strbuf, "BRDS_code=%d, MULT_code=%d \r\n", wr_out_code, en_out_code); |
Slord2142 | 0:b3410a1e9843 | 160 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 161 | } |
Slord2142 | 0:b3410a1e9843 | 162 | |
Slord2142 | 0:b3410a1e9843 | 163 | /******************************************************************************* |
Slord2142 | 0:b3410a1e9843 | 164 | updateTerminal - Save cursor, write data, restore cursor. |
Slord2142 | 0:b3410a1e9843 | 165 | *******************************************************************************/ |
Slord2142 | 0:b3410a1e9843 | 166 | void updateTerminal(struct adcValues adcVals, struct statusValues statVals){ |
Slord2142 | 0:b3410a1e9843 | 167 | //get cursor pos, store in CUR_POS |
Slord2142 | 0:b3410a1e9843 | 168 | sprintf( strbuf, "%c7", 27 ); // ESC=27, Save cursor position = [s |
Slord2142 | 0:b3410a1e9843 | 169 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 170 | |
Slord2142 | 0:b3410a1e9843 | 171 | refreshStatus(statVals); |
Slord2142 | 0:b3410a1e9843 | 172 | refreshData(adcVals); |
Slord2142 | 0:b3410a1e9843 | 173 | |
Slord2142 | 0:b3410a1e9843 | 174 | //move cursor to CUR_POS |
Slord2142 | 0:b3410a1e9843 | 175 | sprintf( strbuf, "%c8", 27 ); // ESC=27, Save cursor position = [s |
Slord2142 | 0:b3410a1e9843 | 176 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 177 | } |
Slord2142 | 0:b3410a1e9843 | 178 | |
Slord2142 | 0:b3410a1e9843 | 179 | /******************************************************************************* |
Slord2142 | 0:b3410a1e9843 | 180 | clrScrn - clears terminal and moves cursor to upper-left corner |
Slord2142 | 0:b3410a1e9843 | 181 | *******************************************************************************/ |
Slord2142 | 0:b3410a1e9843 | 182 | // clears terminal |
Slord2142 | 0:b3410a1e9843 | 183 | void clrScrn(void){ |
Slord2142 | 0:b3410a1e9843 | 184 | sprintf( strbuf, "%c[2J", 27 ); // ESC=27, Clear screen = [2J |
Slord2142 | 0:b3410a1e9843 | 185 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 186 | sprintf( strbuf, "%c[f", 27 ); // ESC=27, Move cursor to upper-left corner = [f |
Slord2142 | 0:b3410a1e9843 | 187 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 188 | } |
Slord2142 | 0:b3410a1e9843 | 189 | |
Slord2142 | 0:b3410a1e9843 | 190 | /******************************************************************************* |
Slord2142 | 0:b3410a1e9843 | 191 | menuRedraw - Write menu to terminal |
Slord2142 | 0:b3410a1e9843 | 192 | *******************************************************************************/ |
Slord2142 | 0:b3410a1e9843 | 193 | // clears terminal and re-draws main menu |
Slord2142 | 0:b3410a1e9843 | 194 | void menuRedraw(bool prompt){ |
Slord2142 | 0:b3410a1e9843 | 195 | clrScrn(); |
Slord2142 | 0:b3410a1e9843 | 196 | menu_banner(); |
Slord2142 | 0:b3410a1e9843 | 197 | |
Slord2142 | 0:b3410a1e9843 | 198 | sprintf( strbuf, "%c[34m", 27 ); // ESC=27, Blue Text |
Slord2142 | 0:b3410a1e9843 | 199 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 200 | |
Slord2142 | 0:b3410a1e9843 | 201 | sprintf(strbuf, " Agility Power Systems DCM1 v1.0 LUT v%1.1f\r\n\r\n", LUT_VER); |
Slord2142 | 0:b3410a1e9843 | 202 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 203 | |
Slord2142 | 0:b3410a1e9843 | 204 | sprintf( strbuf, "%c[0m", 27 ); // ESC=27, Normal |
Slord2142 | 0:b3410a1e9843 | 205 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 206 | sprintf( strbuf, "%c[30m", 27 ); // ESC=27, Black Text |
Slord2142 | 0:b3410a1e9843 | 207 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 208 | |
Slord2142 | 0:b3410a1e9843 | 209 | struct adcValues adcVals = getADCresults(); |
Slord2142 | 0:b3410a1e9843 | 210 | struct statusValues statVals = checkLevels(adcVals); |
Slord2142 | 0:b3410a1e9843 | 211 | refreshStatus(statVals); |
Slord2142 | 0:b3410a1e9843 | 212 | refreshData(adcVals); |
Slord2142 | 0:b3410a1e9843 | 213 | |
Slord2142 | 0:b3410a1e9843 | 214 | sprintf(strbuf, "\r\nCommands: (Not Case-Sensitive)"); |
Slord2142 | 0:b3410a1e9843 | 215 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 216 | sprintf(strbuf, "\r\n MENU"); |
Slord2142 | 0:b3410a1e9843 | 217 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 218 | sprintf(strbuf, "\r\n BRDS"); |
Slord2142 | 0:b3410a1e9843 | 219 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 220 | sprintf(strbuf, "\r\n MULT"); |
Slord2142 | 0:b3410a1e9843 | 221 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 222 | sprintf(strbuf, "\r\n ALLOFF"); |
Slord2142 | 0:b3410a1e9843 | 223 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 224 | sprintf(strbuf, "\r\n RUN"); |
Slord2142 | 0:b3410a1e9843 | 225 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 226 | sprintf(strbuf, "\r\n STOP\r\n"); |
Slord2142 | 0:b3410a1e9843 | 227 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 228 | sprintf(strbuf, "\r\n Type \'=number\' after BRDS or MULT to enter value."); |
Slord2142 | 0:b3410a1e9843 | 229 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 230 | sprintf(strbuf, "\r\n e.g. BRDS=4095 will enable all boards.\r\n"); |
Slord2142 | 0:b3410a1e9843 | 231 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 232 | sprintf(strbuf, "\r\n Type \'?\' at end of BRDS or MULT to get status."); |
Slord2142 | 0:b3410a1e9843 | 233 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 234 | sprintf(strbuf, "\r\n e.g. BRDS? will print value of BRDS.\r\n"); |
Slord2142 | 0:b3410a1e9843 | 235 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 236 | |
Slord2142 | 0:b3410a1e9843 | 237 | if(prompt){ |
Slord2142 | 0:b3410a1e9843 | 238 | menuPrompt(MENU_DCM1); |
Slord2142 | 0:b3410a1e9843 | 239 | } |
Slord2142 | 0:b3410a1e9843 | 240 | } |
Slord2142 | 0:b3410a1e9843 | 241 | |
Slord2142 | 0:b3410a1e9843 | 242 | /******************************************************************************* |
Slord2142 | 0:b3410a1e9843 | 243 | sendLevelsWarning |
Slord2142 | 0:b3410a1e9843 | 244 | *******************************************************************************/ |
Slord2142 | 0:b3410a1e9843 | 245 | void sendLevelsWarning(void){ |
Slord2142 | 0:b3410a1e9843 | 246 | sprintf(strbuf, "\r\nSome voltage levels are out of range. I would look into it if I were you.\r\n"); |
Slord2142 | 0:b3410a1e9843 | 247 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 248 | } |
Slord2142 | 0:b3410a1e9843 | 249 | |
Slord2142 | 0:b3410a1e9843 | 250 | /******************************************************************************* |
Slord2142 | 0:b3410a1e9843 | 251 | menuPrompt - Write menu prompt to terminal |
Slord2142 | 0:b3410a1e9843 | 252 | *******************************************************************************/ |
Slord2142 | 0:b3410a1e9843 | 253 | // sends carriage return and linefeed and prompt character |
Slord2142 | 0:b3410a1e9843 | 254 | void menuPrompt(int menuType) |
Slord2142 | 0:b3410a1e9843 | 255 | { |
Slord2142 | 0:b3410a1e9843 | 256 | char strMenu[30] ={0}; |
Slord2142 | 0:b3410a1e9843 | 257 | |
Slord2142 | 0:b3410a1e9843 | 258 | switch(menuType) |
Slord2142 | 0:b3410a1e9843 | 259 | { |
Slord2142 | 0:b3410a1e9843 | 260 | case MENU_DCM1: strcpy(strMenu,"DCM1"); break; |
Slord2142 | 0:b3410a1e9843 | 261 | case MENU_CALIBRATE: strcpy(strMenu,"CAL"); break; |
Slord2142 | 0:b3410a1e9843 | 262 | case MENU_TEST: strcpy(strMenu,"TEST"); break; |
Slord2142 | 0:b3410a1e9843 | 263 | case MENU_MAIN: strcpy(strMenu,"MAIN"); break; |
Slord2142 | 0:b3410a1e9843 | 264 | default: strcpy(strMenu,"UNDF"); break; |
Slord2142 | 0:b3410a1e9843 | 265 | } |
Slord2142 | 0:b3410a1e9843 | 266 | |
Slord2142 | 0:b3410a1e9843 | 267 | // append the CR,LF and the ready character |
Slord2142 | 0:b3410a1e9843 | 268 | if(serialStatus.computer) |
Slord2142 | 0:b3410a1e9843 | 269 | { |
Slord2142 | 0:b3410a1e9843 | 270 | sendSerial("\r"); |
Slord2142 | 0:b3410a1e9843 | 271 | } |
Slord2142 | 0:b3410a1e9843 | 272 | else |
Slord2142 | 0:b3410a1e9843 | 273 | { |
Slord2142 | 0:b3410a1e9843 | 274 | // adds a carrot so you know you are talking in terminal |
Slord2142 | 0:b3410a1e9843 | 275 | sprintf(strbuf,"\n\r%s>",strMenu); |
Slord2142 | 0:b3410a1e9843 | 276 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 277 | // sendSerial("\n\r>"); |
Slord2142 | 0:b3410a1e9843 | 278 | } |
Slord2142 | 0:b3410a1e9843 | 279 | } |
Slord2142 | 0:b3410a1e9843 | 280 | |
Slord2142 | 0:b3410a1e9843 | 281 | void menu_banner(void) |
Slord2142 | 0:b3410a1e9843 | 282 | { |
Slord2142 | 0:b3410a1e9843 | 283 | clrScrn(); |
Slord2142 | 0:b3410a1e9843 | 284 | sprintf( strbuf, "%c[30m", 27 ); // ESC=27, Black Text |
Slord2142 | 0:b3410a1e9843 | 285 | sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 286 | sprintf(strbuf," ___ _ ___ __ ____ _____ __ \r\n");sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 287 | sprintf(strbuf," / | ____ _(_) (_) /___ __ / __ \\____ _ _____ _____ / ___/__ _______/ /____ ____ ___ _____\r\n");sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 288 | sprintf(strbuf," / /| |/ __ `/ / / / __/ / / / / /_/ / __ \\ | /| / / _ \\/ ___/ \\__ \\/ / / / ___/ __/ _ \\/ __ `__ \\/ ___/\r\n");sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 289 | sprintf(strbuf," / ___ / /_/ / / / / /_/ /_/ / / ____/ /_/ / |/ |/ / __/ / ___/ / /_/ (__ ) /_/ __/ / / / / (__ ) \r\n");sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 290 | sprintf(strbuf,"/_/ |_\\__, /_/_/_/\\__/\\__, / /_/ \\____/|__/|__/\\___/_/ /____/\\__, /____/\\__/\\___/_/ /_/ /_/____/ \r\n");sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 291 | sprintf(strbuf," /____/ /____/ /____/ \r\n");sendSerial(strbuf); |
Slord2142 | 0:b3410a1e9843 | 292 | } |
Slord2142 | 0:b3410a1e9843 | 293 | /* |
Slord2142 | 0:b3410a1e9843 | 294 | sprintf(strbuf," ___ _ ___ __ ____ _____ __ \r\n"); |
Slord2142 | 0:b3410a1e9843 | 295 | sprintf(strbuf," / | ____ _(_) (_) /___ __ / __ \____ _ _____ _____ / ___/__ _______/ /____ ____ ___ _____\r\n"); |
Slord2142 | 0:b3410a1e9843 | 296 | sprintf(strbuf," / /| |/ __ `/ / / / __/ / / / / /_/ / __ \ | /| / / _ \/ ___/ \__ \/ / / / ___/ __/ _ \/ __ `__ \/ ___/\r\n"); |
Slord2142 | 0:b3410a1e9843 | 297 | sprintf(strbuf," / ___ / /_/ / / / / /_/ /_/ / / ____/ /_/ / |/ |/ / __/ / ___/ / /_/ (__ ) /_/ __/ / / / / (__ ) \r\n"); |
Slord2142 | 0:b3410a1e9843 | 298 | sprintf(strbuf,"/_/ |_\__, /_/_/_/\__/\__, / /_/ \____/|__/|__/\___/_/ /____/\__, /____/\__/\___/_/ /_/ /_/____/ \r\n"); |
Slord2142 | 0:b3410a1e9843 | 299 | sprintf(strbuf," /____/ /____/ /____/ \r\n"); |
Slord2142 | 0:b3410a1e9843 | 300 | */ |