Notes en vrac, pour plus tard :
void PP_SIGFOX_StartupMessage (float windSpeed, float windHeading) {
message[0]= SIGFOX_STARTUP_MESSAGE | EncodeWindHeading(windHeading);
message[1]=EncodeWindSpeed(windSpeed);
message[2]=TD_MEASURE_VoltageTemperature(false); //voltage
// embed compilation date in startup message
//MMM DD YYYY
//01234567890
message[3]=__DATE__[0];
message[4]=__DATE__[1];
message[5]=__DATE__[2];
message[6]=__DATE__[4];
message[7]=__DATE__[5];
message[8]=__DATE__[9];
message[9]=__DATE__[10];
SIGFOX_SEND(message, 10);
}
voltage in 1/10s of mV plus 2 V if MSB is 0, or plus 3 V if MSB is 1.
if (measure >= 3000) {
msb = 0x80;
measure -= 3000;
} else {
msb = 0x00;
measure -= 2000;
}
// Divide by 10 with proper rounding
measure /= 5;
return (measure & 1) ? (measure >> 1) + 1 + msb : (measure >> 1) + msb;
voltage in 1/10s of mV plus 2 V if MSB is 0, or plus 3 V if MSB is 1.
static uint8_t EncodeVoltage(float milliVolts) {
return (uint8_t)(float)((milliVolts / 10. + 0.5) - 200.);
}
TD_MEASURE_VoltageTemperatureExtended(false);
* @return
* The measured temperature is given in 1/10 degrees Celsius, the power supply
* voltage is given in mV.
return (uint8_t)(float)((milliVolts / 10. + 0.5) - 200.);
static void ProbeVoltage () {
int32_t voltage = TD_MEASURE_VoltageTemperatureExtended(false);
if (voltage == 2000) return; // = reading has failed ?
if (voltage < voltageMin) voltageMin = voltage;
if (voltage > voltageMax) voltageMax = voltage;
voltageAvg += voltage;
voltageCount++;
}