diff --git a/src/wspr.c b/src/wspr.c --- a/src/wspr.c +++ b/src/wspr.c @@ -135,20 +135,26 @@ void wspr_transmit(uint8_t* grid_locator //////////////////////////////////////// // Encode value from -50C to 39C => 0-89. TODO: Bounds! - uint8_t temp_enc = 12 + 50; + uint32_t temp_enc = adc_get_dietemp() + 50; + if(temp_enc > 89) + temp_enc = 89; // Encode value from 0-39 with some scalar/offset/etc - uint8_t batt_enc = 16; + uint32_t batt_enc = adc_get_vbatt(); // Hopefully in decivolts + if(batt_enc > 39) + batt_enc = 39; // Encode speed in knots from 0-82 to 0-41 - uint8_t speed_enc = gps_getdata()->speed / 2; + uint32_t speed_enc = gps_getdata()->speed / 2; if(speed_enc > 41) speed_enc = 41; // Encode GPS status - uint8_t gps_status = 0b00; // MSB is valid fix, lsb is sats > 8 + uint32_t gps_status = 0b00; // MSB is valid fix, lsb is sats > 8 + - if(gps_getdata()->fixtype == 2 || gps_getdata()->fixtype == 3) + // We always have a fix if we got to this point; and I think we zero out that we had a fix when turning the GPS off before entering this function +// if(gps_getdata()->fixtype == 2 || gps_getdata()->fixtype == 3) gps_status |= 0b10; if(gps_getdata()->sats_in_solution > 5)