Extend AeroAlign with mixed CoG planning and telemetry base

This commit is contained in:
2026-03-11 23:14:33 +01:00
parent 538c3081bf
commit 56890272a0
28 changed files with 1631 additions and 1332 deletions
+16 -2
View File
@@ -161,9 +161,18 @@ void ESPNowMaster::handleReceivedPacket(const uint8_t *mac, const uint8_t *data,
if (node) {
// Update node data
node->device_type = static_cast<DeviceType>(packet.device_type);
node->pitch = packet.pitch;
node->roll = packet.roll;
node->yaw = packet.yaw;
node->front_weight_g = 0.0f;
node->rear_weight_g = 0.0f;
node->cog_position_mm = 0.0f;
if (node->device_type == DEVICE_TYPE_COG_SCALE || node->device_type == DEVICE_TYPE_HYBRID) {
node->front_weight_g = packet.pitch;
node->rear_weight_g = packet.roll;
node->cog_position_mm = packet.yaw;
}
node->battery_percent = packet.battery;
node->is_connected = true;
node->last_update_ms = millis();
@@ -176,8 +185,9 @@ void ESPNowMaster::handleReceivedPacket(const uint8_t *mac, const uint8_t *data,
total_packets_received++;
#ifdef DEBUG_ESPNOW_PACKETS
Serial.printf("[ESP-NOW] RX from 0x%02X: pitch=%.2f° roll=%.2f° battery=%d%% RSSI=%ddBm\n",
packet.node_id, packet.pitch, packet.roll, packet.battery, node->rssi);
Serial.printf("[ESP-NOW] RX from 0x%02X (%s): a=%.2f b=%.2f c=%.2f battery=%d%% RSSI=%ddBm\n",
packet.node_id, deviceTypeToString(node->device_type),
packet.pitch, packet.roll, packet.yaw, packet.battery, node->rssi);
#endif
}
}
@@ -206,11 +216,15 @@ void ESPNowMaster::registerNode(uint8_t node_id, const uint8_t *mac) {
if (nodes[i].node_id == 0) {
// Initialize new node
nodes[i].node_id = node_id;
nodes[i].device_type = DEVICE_TYPE_UNKNOWN;
memcpy(nodes[i].mac_address, mac, 6);
snprintf(nodes[i].label, sizeof(nodes[i].label), "Sensor %d", node_id - 1);
nodes[i].pitch = 0.0;
nodes[i].roll = 0.0;
nodes[i].yaw = 0.0;
nodes[i].front_weight_g = 0.0;
nodes[i].rear_weight_g = 0.0;
nodes[i].cog_position_mm = 0.0;
nodes[i].pitch_offset = 0.0;
nodes[i].roll_offset = 0.0;
nodes[i].yaw_offset = 0.0;