Updated proto and embedded build for nanopb + esp fix
This commit is contained in:
@@ -34,6 +34,14 @@ jobs:
|
||||
- name: Install PlatformIO Core
|
||||
run: pip install --upgrade platformio
|
||||
|
||||
|
||||
- name: Install Python dependencies for nanopb
|
||||
run: pip install protobuf grpcio-tools
|
||||
|
||||
- name: Build Protocol Buffers (nanopb)
|
||||
run: python ./submodules/nanopb/generator/nanopb_generator.py -I "./platform_shared/" -D esp32/src/platform_shared ./platform_shared/websocket_message.proto ./platform_shared/rest_message.proto
|
||||
|
||||
|
||||
- name: Build PlatformIO Project
|
||||
run: pio run
|
||||
|
||||
|
||||
@@ -19,6 +19,19 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: pip install protobuf grpcio-tools
|
||||
|
||||
- name: Build Protocol Buffers (nanopb)
|
||||
run: python ./submodules/nanopb/generator/nanopb_generator.py -I "./platform_shared/" -D esp32/src/platform_shared ./platform_shared/websocket_message.proto ./platform_shared/rest_message.proto
|
||||
|
||||
- name: Setup Protocol Buffers compiler
|
||||
uses: arduino/setup-protoc@v3
|
||||
|
||||
+1
-1
@@ -11,4 +11,4 @@ protoc -I=platform_shared --cpp_out=esp32/src/platform_shared platform_shared/ex
|
||||
|
||||
C++ (nanopb):
|
||||
pip install protobuf grpcio-tools
|
||||
python .\submodules\nanopb\generator\nanopb_generator.py -D esp32/src .\platform_shared\example.proto
|
||||
python ./submodules/nanopb/generator/nanopb_generator.py -I "./platform_shared/" -D esp32/src ./platform_shared/websocket_message.proto ./platform_shared/rest_message.proto
|
||||
+12
-8
@@ -17,9 +17,11 @@
|
||||
#include <mdns_service.h>
|
||||
#include <system_service.h>
|
||||
|
||||
// Temporary includes
|
||||
#include <pb_encode.h>
|
||||
#include "platform_shared/imu_report.pb.h"
|
||||
#include <pb_decode.h>
|
||||
|
||||
#include <platform_shared/websocket_message.pb.h>
|
||||
|
||||
|
||||
#include <www_mount.hpp>
|
||||
|
||||
@@ -241,21 +243,23 @@ void IRAM_ATTR serviceLoopEntry(void *) {
|
||||
// socket.emit(EVENT_IMU, results);
|
||||
|
||||
// TESTING PB EMITTING!!
|
||||
IMUReport report;
|
||||
socket_message_IMUData report;
|
||||
report.x = 1;
|
||||
report.y = 2;
|
||||
report.z = 3;
|
||||
report.temp = temp;
|
||||
report.altitude = 10;
|
||||
report.bmp_temp = temp;
|
||||
temp += 0.01;
|
||||
report.success = true;
|
||||
report.heading = 20;
|
||||
report.pressure = 40;
|
||||
|
||||
uint8_t buffer[IMUReport_size];
|
||||
uint8_t buffer[socket_message_IMUData_size];
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));
|
||||
bool status = pb_encode(&stream, &IMUReport_msg, &report);
|
||||
bool status = pb_encode(&stream, &socket_message_IMUData_msg, &report);
|
||||
if (!status) {
|
||||
// PRINT ERROR HERE!
|
||||
}
|
||||
socket.emit_raw(EVENT_IMU, buffer, strlen(EVENT_IMU), IMUReport_size);
|
||||
socket.emit_raw(EVENT_IMU, buffer, strlen(EVENT_IMU), socket_message_IMUData_size);
|
||||
});
|
||||
|
||||
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||
|
||||
Reference in New Issue
Block a user