elixys periphreal system firmware library
Dependencies: MAX31855 MCP23S18 MCP3202 MCP3208 MCP482x ShiftRegister1
Fork of elixys by
Diff: elixys.cpp
- Revision:
- 3:1b20a56e4457
- Parent:
- 1:b0f7c49b67f8
--- a/elixys.cpp Sun Dec 15 02:45:52 2013 +0000 +++ b/elixys.cpp Sun Dec 15 22:44:32 2013 +0000 @@ -221,6 +221,8 @@ int tc_test() { float fvalue[9]; + char resbuf[100]="\0"; + char valbuf[6] = "\0"; fvalue[0] = tcintf0.read_temp(); fvalue[1] = tcintf1.read_temp(); fvalue[2] = tcintf2.read_temp(); @@ -231,29 +233,31 @@ fvalue[7] = tcintf7.read_temp(); fvalue[8] = tcintf8.read_temp(); - stringstream res("THERMOCOUPLES|"); + strcat(resbuf,"THERMOS"); for(int idx=0;idx<9;idx++) { if (fvalue[idx] > 2000){ if(fvalue[idx]==2001){ - res << "NoTC,"; + strcat(resbuf,"NoTC,"); }else if(fvalue[idx]==2002){ - res << "ShrtGnd,"; + strcat(resbuf,"ShrtGnd,"); }else if(fvalue[idx]==2004){ - res << "ShrtVCC,"; + strcat(resbuf,"ShrtVCC,"); } }else{ - res << fvalue[idx] << ","; + valbuf[0] = '\0'; + sprintf(valbuf,"%3.2f,", fvalue[idx]); + strcat(resbuf,valbuf); } } - res << "\r\n"; - printf(res.str().c_str()); + strcat(resbuf,"\r\n"); + printf(resbuf); return 0; } void valve_test() { setup_valves(); for(int i=0;i<16;i++) { - printf("VALVEID:%d\r\n",i); + printf("VALVES:ID=%d\r\n",i); set_valves(0,(1<<i)); set_valves(1,(1<<i)); set_valves(2,(1<<i)); @@ -268,7 +272,7 @@ set_valves(0,0x0000); set_valves(1,0x0000); set_valves(2,0x0000); - printf("VALVESAllOff\r\n"); + printf("VALVES:AllOff\r\n"); wait(0.1); }