Revert "factor out sendTelemetry function"

This reverts commit b61ba1a3c5.
This commit is contained in:
Tavis 2024-07-15 19:38:38 -10:00
parent b61ba1a3c5
commit d0af9cfd7d
3 changed files with 13 additions and 24 deletions

@ -1 +1 @@
Subproject commit 8f4faf76e52c2ef63c582c26642d312d9781b7c0 Subproject commit d191975ebc572527c6d9eec48d5b0a1e3331999f

View File

@ -336,7 +336,18 @@ int32_t SerialModule::runOnce()
m.variant.environment_metrics.wind_lull, m.variant.environment_metrics.wind_gust, m.variant.environment_metrics.wind_lull, m.variant.environment_metrics.wind_gust,
m.variant.environment_metrics.voltage); m.variant.environment_metrics.voltage);
sendTelemetry(m); meshtastic_MeshPacket *p = router->allocForSending();
p->decoded.portnum = meshtastic_PortNum_TELEMETRY_APP;
p->decoded.payload.size = pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes),
&meshtastic_Telemetry_msg, &m);
LOG_INFO("payload size : %i\n", p->decoded.payload.size);
p->to = NODENUM_BROADCAST;
p->decoded.want_response = false;
p->priority = meshtastic_MeshPacket_Priority_RELIABLE;
service.sendToMesh(p, RX_SRC_LOCAL, true);
// reset counters and gust/lull // reset counters and gust/lull
velSum = velCount = dirCount = 0; velSum = velCount = dirCount = 0;
@ -362,27 +373,6 @@ int32_t SerialModule::runOnce()
} }
} }
/**
* Sends telemetry packet over the mesh network.
*
* @param m The telemetry data to be sent
*
* @return void
*
* @throws None
*/
void SerialModule::sendTelemetry(meshtastic_Telemetry m)
{
meshtastic_MeshPacket *p = router->allocForSending();
p->decoded.portnum = meshtastic_PortNum_TELEMETRY_APP;
p->decoded.payload.size =
pb_encode_to_bytes(p->decoded.payload.bytes, sizeof(p->decoded.payload.bytes), &meshtastic_Telemetry_msg, &m);
p->to = NODENUM_BROADCAST;
p->decoded.want_response = false;
p->priority = meshtastic_MeshPacket_Priority_RELIABLE;
service.sendToMesh(p, RX_SRC_LOCAL, true);
}
/** /**
* Allocates a new mesh packet for use as a reply to a received packet. * Allocates a new mesh packet for use as a reply to a received packet.
* *

View File

@ -28,7 +28,6 @@ class SerialModule : public StreamAPI, private concurrency::OSThread
private: private:
uint32_t getBaudRate(); uint32_t getBaudRate();
void sendTelemetry(meshtastic_Telemetry m);
}; };
extern SerialModule *serialModule; extern SerialModule *serialModule;