This commit is contained in:
2025-04-28 20:59:39 +02:00
parent f438f711ca
commit 9229711870
2 changed files with 16 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
{
"C_Cpp.intelliSenseEngine": "default",
"idf.espIdfPath": "/home/bruno/esp/master/esp-idf",
"idf.espIdfPath": "/home/bruno/esp/v5.4.1/esp-idf",
"idf.pythonInstallPath": "/usr/bin/python",
"idf.openOcdConfigs": [
"board/esp32s3-builtin.cfg"

View File

@@ -8,6 +8,8 @@
#include "packets.h"
#include "esp_rom_crc.h"
#include "mbedtls/base64.h"
#define TAG "LoRaGS"
uint32_t uplinkPacketIndex = 0;
@@ -145,7 +147,7 @@ void printTelemetryPacket(const TelemetryPacket *packet)
// GPS Data
ESP_LOGI(TAG, " GPS:");
ESP_LOGI(TAG, " Time (seconds): %u", packet->time_seconds);
ESP_LOGI(TAG, " Time (seconds): %lu", packet->time_seconds);
ESP_LOGI(TAG, " Latitude: %.4f°", packet->latitude_centi_degrees / 10000.0f);
ESP_LOGI(TAG, " Longitude: %.4f°", packet->longitude_centi_degrees / 10000.0f);
ESP_LOGI(TAG, " Altitude: %.2f m", packet->altitude_centi_meters / 100.0f);
@@ -163,10 +165,10 @@ void printTelemetryPacket(const TelemetryPacket *packet)
{
// ADC Data
ESP_LOGI(TAG, " ADC Sensors:");
ESP_LOGI(TAG, " NH3: %d", packet->NH3);
ESP_LOGI(TAG, " CO: %d", packet->CO);
ESP_LOGI(TAG, " NO2: %d", packet->NO2);
ESP_LOGI(TAG, " UVC: %d", packet->UVC);
ESP_LOGI(TAG, " NH3: %ld", packet->NH3);
ESP_LOGI(TAG, " CO: %ld", packet->CO);
ESP_LOGI(TAG, " NO2: %ld", packet->NO2);
ESP_LOGI(TAG, " UVC: %ld", packet->UVC);
} else {
ESP_LOGE(TAG, " IO Expander not plugged in");
}
@@ -205,10 +207,16 @@ void handle_downlink_packet(uint8_t *buf, uint8_t rxLen)
if (crcCheck != down.CRCCheck)
{
ESP_LOGE(TAG, "Received BAD CRC for packet %d, crc is %ld, should be %ld", down.packetIndex, crcCheck, down.CRCCheck);
ESP_LOGE(TAG, "Received BAD CRC for packet %ld, crc is %ld, should be %ld", down.packetIndex, crcCheck, down.CRCCheck);
return;
}
unsigned char outBuf[345];
size_t output_len = 0; // will store the real output size
mbedtls_base64_encode(outBuf, sizeof(outBuf), &output_len, buf, rxLen);
printf("Got DownLink data %d: %s\n", output_len, outBuf);
switch (down.packetType)
{
case DownlinkPacketType_Telemetry:
@@ -221,7 +229,7 @@ void handle_downlink_packet(uint8_t *buf, uint8_t rxLen)
}
else
{
ESP_LOGW(TAG, "Telemetry packet too small (%u bytes)", payloadSize);
ESP_LOGW(TAG, "Telemetry packet too small (%lu bytes)", payloadSize);
}
break;
case DownlinkPacketType_Ping: