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/main.cpp
- Revision:
- 6:39442d493098
- Parent:
- 5:09be5bbb5020
- Child:
- 7:860b3a8275cb
diff -r 09be5bbb5020 -r 39442d493098 src/main.cpp
--- a/src/main.cpp Sat Dec 01 00:08:53 2018 +0000
+++ b/src/main.cpp Mon Dec 03 01:03:14 2018 +0000
@@ -39,19 +39,28 @@
unsigned int boardsActive;
unsigned int boardMults;
-unsigned int v48, v24, v12; // Voltage divide ratio is a little low due to substituting 10k resistors in place of the 100k. The 100k caused the opamps to oscillate.
-unsigned int i48, i24, i12;
+unsigned short v48, v24, v12; // Voltage divide ratio is a little low due to substituting 10k resistors in place of the 100k. The 100k caused the opamps to oscillate.
+unsigned short i48, i24, i12;
unsigned int binCode[6];
+unsigned int en_out_code;
unsigned int thermCode[17];
+unsigned int wr_out_code;
unsigned int commandData;
+unsigned short my12=0;
+unsigned int updateRefreshTicks=0;
+volatile bool updateReady = FALSE;
+unsigned int loopTime = 0;
+
+Timer masterTimer;
int main()
{
//int stopExecuted = 0;
extchlat = OFF;
- setBoardEnables(ALLOFF);
- setBoardWeights(ALLOFF); // RK: Maybe? Use hex value for boardWeights to highlight that it's an encoded value.
+ wr_out_code = setBoardEnables(ALLOFF);
+ //setBoardEnables((unsigned int *)alloff);
+ en_out_code = setBoardWeights(ALLOFF); // RK: Maybe? Use hex value for boardWeights to highlight that it's an encoded value.
sprintf(strbuf, "\r\nAgility Power Systems DCM1 Rev 0.3"); //RK 10/26/2018
sendSerial(strbuf);
@@ -59,18 +68,32 @@
menuPrompt(MENU_DCM1);
initSerial();
+ initDRT();
initADC();
+ getADCvolts();
+ getADCamps();
menuRedraw();
while (1)
{
processCommand();
+ getADCvolts();
+ getADCamps();
+
+ if(updateReady){
+ updateReady = FALSE;
+ updateTerminal(); // May want to gate this call when we run a headless system.
+ loopTime = masterTimer.read_ms();// - loopTime;
+ }
+
if(running){
- getADCvolts();
- getADCamps();
//updateControls();
- //updateControls(my12);
+ updateControls(i12);
+ }else{
+ //wr_out_code = setBoardEnables(ALLOFF);
+ //setBoardEnables((unsigned int *)alloff);
+ updateControls(my12);
}
//myled = 1;