use autogened protobuf init code

1.2-legacy
Kevin Hester 2020-12-07 10:27:31 +08:00
rodzic 90060e84c0
commit 79a24c200e
2 zmienionych plików z 3 dodań i 5 usunięć

Wyświetl plik

@ -194,9 +194,7 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused)
{ {
// Update our local node info with our position (even if we don't decide to update anyone else) // Update our local node info with our position (even if we don't decide to update anyone else)
Position pos; Position pos = Position_init_default;
memset(&pos, 0, sizeof(pos));
if (gps->hasLock()) { if (gps->hasLock()) {
if (gps->altitude != 0) if (gps->altitude != 0)

Wyświetl plik

@ -13,6 +13,7 @@ RemoteHardwarePlugin remoteHardwarePlugin;
// A macro for clearing a struct, FIXME, move elsewhere // A macro for clearing a struct, FIXME, move elsewhere
#define CLEAR_STRUCT(r) memset(&r, 0, sizeof(r)) #define CLEAR_STRUCT(r) memset(&r, 0, sizeof(r))
bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, const HardwareMessage &p) bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, const HardwareMessage &p)
{ {
switch (p.typ) { switch (p.typ) {
@ -43,8 +44,7 @@ bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, const H
} }
// Send the reply // Send the reply
HardwareMessage reply; HardwareMessage reply = HardwareMessage_init_default;
CLEAR_STRUCT(reply);
reply.typ = HardwareMessage_Type_READ_GPIOS_REPLY; reply.typ = HardwareMessage_Type_READ_GPIOS_REPLY;
reply.gpio_value = res; reply.gpio_value = res;
MeshPacket *p = allocDataProtobuf(reply); MeshPacket *p = allocDataProtobuf(reply);