update
This commit is contained in:
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"C_Cpp.intelliSenseEngine": "default",
|
"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.pythonInstallPath": "/usr/bin/python",
|
||||||
"idf.openOcdConfigs": [
|
"idf.openOcdConfigs": [
|
||||||
"board/esp32s3-builtin.cfg"
|
"board/esp32s3-builtin.cfg"
|
||||||
|
22
main/radio.c
22
main/radio.c
@@ -8,6 +8,8 @@
|
|||||||
#include "packets.h"
|
#include "packets.h"
|
||||||
#include "esp_rom_crc.h"
|
#include "esp_rom_crc.h"
|
||||||
|
|
||||||
|
#include "mbedtls/base64.h"
|
||||||
|
|
||||||
#define TAG "LoRaGS"
|
#define TAG "LoRaGS"
|
||||||
|
|
||||||
uint32_t uplinkPacketIndex = 0;
|
uint32_t uplinkPacketIndex = 0;
|
||||||
@@ -145,7 +147,7 @@ void printTelemetryPacket(const TelemetryPacket *packet)
|
|||||||
|
|
||||||
// GPS Data
|
// GPS Data
|
||||||
ESP_LOGI(TAG, " GPS:");
|
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, " Latitude: %.4f°", packet->latitude_centi_degrees / 10000.0f);
|
||||||
ESP_LOGI(TAG, " Longitude: %.4f°", packet->longitude_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);
|
ESP_LOGI(TAG, " Altitude: %.2f m", packet->altitude_centi_meters / 100.0f);
|
||||||
@@ -163,10 +165,10 @@ void printTelemetryPacket(const TelemetryPacket *packet)
|
|||||||
{
|
{
|
||||||
// ADC Data
|
// ADC Data
|
||||||
ESP_LOGI(TAG, " ADC Sensors:");
|
ESP_LOGI(TAG, " ADC Sensors:");
|
||||||
ESP_LOGI(TAG, " NH3: %d", packet->NH3);
|
ESP_LOGI(TAG, " NH3: %ld", packet->NH3);
|
||||||
ESP_LOGI(TAG, " CO: %d", packet->CO);
|
ESP_LOGI(TAG, " CO: %ld", packet->CO);
|
||||||
ESP_LOGI(TAG, " NO2: %d", packet->NO2);
|
ESP_LOGI(TAG, " NO2: %ld", packet->NO2);
|
||||||
ESP_LOGI(TAG, " UVC: %d", packet->UVC);
|
ESP_LOGI(TAG, " UVC: %ld", packet->UVC);
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, " IO Expander not plugged in");
|
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)
|
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;
|
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)
|
switch (down.packetType)
|
||||||
{
|
{
|
||||||
case DownlinkPacketType_Telemetry:
|
case DownlinkPacketType_Telemetry:
|
||||||
@@ -221,7 +229,7 @@ void handle_downlink_packet(uint8_t *buf, uint8_t rxLen)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ESP_LOGW(TAG, "Telemetry packet too small (%u bytes)", payloadSize);
|
ESP_LOGW(TAG, "Telemetry packet too small (%lu bytes)", payloadSize);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DownlinkPacketType_Ping:
|
case DownlinkPacketType_Ping:
|
||||||
|
Reference in New Issue
Block a user