@@ -231,6 +231,7 @@ void ArgosTxService::process_sensor_burst() {
231231 m_depth_pile_manager.retrieve_sensor_single ((unsigned int )argos_config.depth_pile , ServiceIdentifier::PH_SENSOR),
232232 m_depth_pile_manager.retrieve_sensor_single ((unsigned int )argos_config.depth_pile , ServiceIdentifier::PRESSURE_SENSOR),
233233 m_depth_pile_manager.retrieve_sensor_single ((unsigned int )argos_config.depth_pile , ServiceIdentifier::SEA_TEMP_SENSOR),
234+ m_depth_pile_manager.retrieve_sensor_single ((unsigned int )argos_config.depth_pile , ServiceIdentifier::BARO_SENSOR), // Tom
234235 argos_config.is_lb ,
235236 argos_config.is_out_of_zone ,
236237 size_bits);
@@ -602,6 +603,7 @@ ArticPacket ArgosPacketBuilder::build_sensor_packet(GPSLogEntry* gps_entry,
602603 ServiceSensorData *ph_sensor,
603604 ServiceSensorData *pressure_sensor,
604605 ServiceSensorData *sea_temp_sensor,
606+ ServiceSensorData *baro_sensor, // Tom
605607 bool is_out_of_zone, bool is_low_battery,
606608 unsigned int & size_bits) {
607609
@@ -679,6 +681,10 @@ ArticPacket ArgosPacketBuilder::build_sensor_packet(GPSLogEntry* gps_entry,
679681 DEBUG_TRACE (" ArgosPacketBuilder::build_sensor_packet: sea_temp=%06X" , (unsigned int )sea_temp_sensor->port [0 ]);
680682 PACK_BITS ((unsigned int )sea_temp_sensor->port [0 ], packet, base_pos, 21 );
681683 }
684+ if (baro_sensor != nullptr ) {
685+ DEBUG_TRACE (" ArgosPacketBuilder::build_sensor_packet: baro=%06X" , (unsigned int )baro_sensor->port [0 ]);
686+ PACK_BITS ((unsigned int )baro_sensor->port [0 ], packet, base_pos, 21 ); // Tom
687+ }
682688
683689 // Calculate CRC8
684690 unsigned char crc8 = CRC8::checksum (packet.substr (1 ), base_pos - 8 );
@@ -1003,6 +1009,14 @@ void ArgosDepthPileManager::notify_peer_event(ServiceEvent& e) {
10031009 ServiceSensorData& entry = std::get<ServiceSensorData>(e.event_data );
10041010 m_sea_temp_cache.port [0 ] = (unsigned int )((entry.port [0 ] + 126.0 ) * 1000U );
10051011 m_sensor_tx_current |= (1 << (int )ServiceIdentifier::SEA_TEMP_SENSOR);
1012+
1013+ } else if (e.event_source == ServiceIdentifier::BARO_SENSOR && // Tom //
1014+ e.event_type == ServiceEventType::SERVICE_LOG_UPDATED) {
1015+ DEBUG_TRACE (" ArgosDepthPileManager::notify_peer_event: BARO cache set" );
1016+ ServiceSensorData& entry = std::get<ServiceSensorData>(e.event_data );
1017+ m_baro_cache.port [0 ] = (unsigned int )((entry.port [0 ] + 0 ) * 1000U );
1018+ m_sensor_tx_current |= (1 << (int )ServiceIdentifier::BARO_SENSOR); // Tom //
1019+
10061020 } else if (e.event_source == ServiceIdentifier::GNSS_SENSOR &&
10071021 e.event_type == ServiceEventType::SERVICE_INACTIVE) {
10081022
@@ -1029,6 +1043,12 @@ void ArgosDepthPileManager::notify_peer_event(ServiceEvent& e) {
10291043 m_sea_temp_cache.port [0 ] = 0xFFFFFFFF ;
10301044 m_sensor_tx_current |= (1 << (int )ServiceIdentifier::SEA_TEMP_SENSOR);
10311045 }
1046+
1047+ else if (((1 << (int )ServiceIdentifier::BARO_SENSOR) & m_sensor_tx_enable) && // Tom
1048+ ((1 << (int )ServiceIdentifier::BARO_SENSOR) & m_sensor_tx_current) == 0 ) {
1049+ m_baro_cache.port [0 ] = 0xFFFFFFFF ;
1050+ m_sensor_tx_current |= (1 << (int )ServiceIdentifier::BARO_SENSOR);
1051+ }
10321052 update_depth_pile ();
10331053 }, " DepthPileTimeout" , Scheduler::DEFAULT_PRIORITY, 2000U );
10341054 }
@@ -1072,6 +1092,10 @@ void ArgosDepthPileManager::update_depth_pile() {
10721092 // Store the entry into the depth pile
10731093 m_sea_temp_depth_pile.store (m_sea_temp_cache, burst_counter);
10741094 }
1095+ if (m_sensor_tx_current & (1 << (int )ServiceIdentifier::BARO_SENSOR)) { // Tom
1096+ // Store the entry into the depth pile
1097+ m_baro_depth_pile.store (m_baro_cache, burst_counter);
1098+ }
10751099 m_sensor_tx_current = 0 ;
10761100 }
10771101}
0 commit comments