Barnaby Ayriss
/
Buhler_BrownoutGen
Diff: main.cpp
- Revision:
- 8:8d47dafb7f11
- Parent:
- 7:fb8b01ec74a8
- Child:
- 9:71eab0a4ceef
--- a/main.cpp Mon Feb 17 13:49:22 2020 +0000 +++ b/main.cpp Mon Feb 17 15:41:08 2020 +0000 @@ -244,8 +244,10 @@ { long int t1,t2; - t1 = (int)tOn*1000; - t2 = (int)((tOff*1000) + t1); + toOn.detach(); + toOff.detach(); + t1 = tOn*1000; + t2 = (tOff*1000) + t1; flg_loop0 = false; flg_loop1 = false; power(1); @@ -258,7 +260,12 @@ { bool flg_lend = true; string str = ""; + flg_loop0 = 0; + flg_loop1 = 0; + + cycle_timeout(tOn,tOff); while(flg_lend) { + led2 = !led2; if(flg_loop0 and flg_loop1) { cycle_timeout(tOn,tOff); } @@ -291,6 +298,7 @@ str = read_serial_input(); if (str == "end") { tickOff.detach(); + toOn.detach(); pc.printf("loop ended\r\n"); power(1); flg_exit = true; @@ -299,7 +307,6 @@ pc.printf("Unknown Command, enter \"end\" to end loop\r\n"); str = ""; } - } } @@ -328,7 +335,7 @@ pc.printf("cycled \r\n"); } else if(str_c == "loopw") { // runs a continuous powercycle loop - pc.printf("Looping. Restart unit to end loop\r\n"); + pc.printf("Looping. Restart unit to end loop \r\n"); cycle_loopw(); } else if (str_c == "cycleto") { @@ -340,7 +347,7 @@ printf("cycleto finish\r\n"); } else if (str_c == "loopto") { - pc.printf("starting loopto \r\n"); + pc.printf("starting loopto, Restart unit to end loop \r\n"); cycle_loopto(); } else if (str_c == "looptick") { @@ -375,7 +382,7 @@ break; case(2): //Cut the power to the machine in a loop - pc.printf("Begining Power cycle loop, to end loop press restart button \r\n"); + pc.printf("Beginning power cycle loop, to end loop press restart button \r\n"); cycle_loopw(); break;