void MeasureMagSens(uint8_t Addr, uint16_t Tref, float* SensX, float* SensY, float* SensZ, const uint8_t TC_Enabled){
uint8_t MagData[9] = {255,255,255,255,255,255,255,255,255};
char s[30];
-
+ char SerNum[10];
char Num[2];
sprintf(Num,"%1u",Addr-12);
twi_writeTo(Addr,&dataTest,1,1, true);
uint8_t status_1;
twi_readFrom(Addr, &status_1, 1, true);
- sprintf(s,"Status: 0x%x",status_1);
+ sprintf(s,"Status %02u 0x%x: 0x%x",SERIALNUM,Addr,status_1);
uputsnl(s);
_delay_ms(100);
}
int16_t temp_temp = (uint16_t)(tMag) - (uint16_t)(Tref);
float Temperature = 35.0 + (temp_temp/45.2);
- uputs("M");uputs(Num);uputs("_T ");
+ uputs("M");sprintf(SerNum,"_%02u_",SERIALNUM);uputs(SerNum);uputs(Num);uputs("_T ");
sprintf(s,"%4.2f",Temperature);
uputsnl(s);
- uputs("M");uputs(Num);uputs("_X ");
+ uputs("M");sprintf(SerNum,"_%02u_",SERIALNUM);uputs(SerNum);uputs(Num);uputs("_X ");
sprintf(s,"%4.3f",((float)xMag*(*SensX))); //muT
uputsnl(s);
- uputs("M");uputs(Num);uputs("_Y ");
+ uputs("M");sprintf(SerNum,"_%02u_",SERIALNUM);uputs(SerNum);uputs(Num);uputs("_Y ");
sprintf(s,"%4.3f",((float)yMag*(*SensY))); //muT
uputsnl(s);
- uputs("M");uputs(Num);uputs("_Z ");
+ uputs("M");sprintf(SerNum,"_%02u_",SERIALNUM);uputs(SerNum);uputs(Num);uputs("_Z ");
sprintf(s,"%4.3f",((float)zMag*(*SensZ))); //muT
uputsnl(s);
- uputs("ERR Mag ");uputs(Num);uputsnl(" NO"); // ERROR INFORMATION FOR EPICS
+ uputs("ERR Mag ");sprintf(SerNum,"%2u ",SERIALNUM);uputs(SerNum);uputs(Num);uputsnl(" NO"); // ERROR INFORMATION FOR EPICS
} else {
- uputs("ERR Mag ");uputs(Num);uputsnl(" CONNECTION");
+ uputs("ERR Mag ");sprintf(SerNum,"%2u ",SERIALNUM);uputs(SerNum);uputs(Num);uputsnl(" CONNECTION");
}
}
\r
int main(void)\r
{ char s[30];\r
+ char SerNum[10];\r
uint8_t Status[4]={0,0,0,0};\r
uint8_t TC_Enabled[4]={0,0,0,0};\r
uint8_t Status_Mag[4]={0,0,0,0};\r
if (mode == 0) {\r
// normal running mode\r
if (Status[0] == 0) { MeasureMagSens(ADDR_MAG_0, TRef[0], &SensX[0], &SensY[0], &SensZ[0], TC_Enabled[0]);}\r
- else { uputsnl("ERR Mag 0 NO_DEVICE"); }\r
+ else { uputs("ERR Mag ");sprintf(SerNum,"%2u ",SERIALNUM);uputs(SerNum); uputsnl("0 NO_DEVICE"); }\r
if (Status[1] == 0) { MeasureMagSens(ADDR_MAG_1, TRef[1], &SensX[1], &SensY[1], &SensZ[1], TC_Enabled[1]);}\r
- else { uputsnl("ERR Mag 1 NO_DEVICE"); }\r
+ else { uputs("ERR Mag ");sprintf(SerNum,"%2u ",SERIALNUM);uputs(SerNum); uputsnl("1 NO_DEVICE"); }\r
if (Status[2] == 0) { MeasureMagSens(ADDR_MAG_2, TRef[2], &SensX[2], &SensY[2], &SensZ[2], TC_Enabled[2]);}\r
- else { uputsnl("ERR Mag 2 NO_DEVICE"); }\r
+ else { uputs("ERR Mag ");sprintf(SerNum,"%2u ",SERIALNUM);uputs(SerNum); uputsnl("2 NO_DEVICE"); }\r
if (Status[3] == 0) { MeasureMagSens(ADDR_MAG_3, TRef[3], &SensX[3], &SensY[3], &SensZ[3], TC_Enabled[3]);}\r
- else { uputsnl("ERR Mag 3 NO_DEVICE"); }\r
+ else { uputs("ERR Mag ");sprintf(SerNum,"%2u ",SERIALNUM);uputs(SerNum); uputsnl("3 NO_DEVICE"); }\r
\r
_delay_ms(500);\r
} else {// CONFIG MODE\r