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:
- 1:bc3509459a27
- Parent:
- 0:b3410a1e9843
diff -r b3410a1e9843 -r bc3509459a27 src/main.cpp --- a/src/main.cpp Thu Jan 27 21:58:14 2022 +0000 +++ b/src/main.cpp Tue Dec 06 18:47:01 2022 +0000 @@ -74,7 +74,7 @@ double CURRENT_48_OFFSET = 33940; double CURRENT_24_OFFSET = 33580; -double CURRENT_12_OFFSET = 33256; +double CURRENT_12_OFFSET = 57700; float temperatureVal; @@ -97,7 +97,7 @@ int main() { - if(MS){ //New for 1U5 + /*if(MS){ //New for 1U5 #ifdef IS_MASTER master = TRUE; #endif @@ -110,12 +110,13 @@ slave1 = FALSE; slave2 = TRUE; #endif - } + }*/ //Slave_Init(); initOut(); - //Serial dcm2(PC_10, PC_11); + //Serial dcm2(PC_10, PC_11, 9600); + //char storage; fan_pwm.period(1.0f); //slowClk.attach_us(&slowFlip, CLK_SLOW); @@ -156,6 +157,9 @@ menuRedraw(WITH_PROMPT); initBoards(adcVals); + + en_out_code = 2; + setClocks(en_out_code); while (1) { @@ -174,12 +178,24 @@ processCommand(); + //dcm2.printf("Hello?"); /*if(dcm2.readable()) { - char storage = dcm2.getc(); + storage = dcm2.getc(); storage += 1; dcm2.putc(storage); }*/ + /*char men = 'm'; + char bor = 'b'; + if (dcm2.readable()) { + storage = dcm2.getc(); + if (storage == men) { + dcm2.printf("This is the demo menu.\n"); + } else if (storage == bor) { + dcm2.printf(" %d\n", boardsActive); + } + }*/ + // Select RUN from menu to activate running mode. // BRDS, MULT activate testing mode. MY12 emulates running mode wthout being in running mode. // CAL and UNCAL do not change state of running or testing. @@ -191,40 +207,41 @@ buck = FALSE; } row_test = abs((int)(row-old_row)); - - if(updateReady && pcConnected){ + //updateTerminal(adcVals, statVals); + if(updateReady){ updateReady = FALSE; updateTerminal(adcVals, statVals); // May want to gate this call when we run a headless system. } #endif - //checkFlip(); - //if(running && master){ //New for 1U5 + /*checkFlip(); + if(running && master){ //New for 1U5 //The current sensors results are single-ended. Results below the midpoint are for buck mode, above is for boost mode. - //if(row_test>ROW_HYSTERESIS){ - //old_row = row; - //if(row<=1023){ - //slave_code = updateMasterControls(row); //New for 1U5 - //sendSlaveCommands(slave_code); //New for 1U5 - //} + if(row_test>ROW_HYSTERESIS){ + old_row = row; + if(row<=1023){ + slave_code = updateMasterControls(row); //New for 1U5 + sendSlaveCommands(slave_code); //New for 1U5 + } + } + } + else if(running && !master){ //New for 1U5 + new_slave_code = getMasterCommands(); //New for 1U5 + if(new_slave_code != slave_code){ + slave_code = new_slave_code; + updateSlaveControls(slave_code); //New for 1U5 //} - //else if(running && !master){ //New for 1U5 - //new_slave_code = getMasterCommands(); //New for 1U5 - //if(new_slave_code != slave_code){ - //slave_code = new_slave_code; - //updateSlaveControls(slave_code); //New for 1U5 - //} - //} - //}else if(!testing){ - //row_test = abs((int)(my12-old_row)); - //if(row_test>ROW_HYSTERESIS){ - //old_row = my12; - //if(row<=1023){ - //updateMasterControls(my12); - //} - //} - //numFast = 36; - //} + } + }else if(!testing){ + row_test = abs((int)(my12-old_row)); + if(row_test>ROW_HYSTERESIS){ + old_row = my12; + if(row<=1023){ + updateMasterControls(my12); + } + } + numFast = 36; + }*/ }//end while(1) }//end void main(void) \ No newline at end of file