Skip to content

Commit

Permalink
Merge pull request #25 from todd-herbert/master
Browse files Browse the repository at this point in the history
Out of the box for Arduino IDE
  • Loading branch information
GUVWAF authored Nov 11, 2024
2 parents 6bab3df + 305f67d commit 03f4cbc
Show file tree
Hide file tree
Showing 61 changed files with 5,100 additions and 511 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/update_protobufs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ jobs:
- name: Download nanopb
run: |
wget https://jpa.kapsi.fi/nanopb/download/nanopb-0.4.7-linux-x86.tar.gz
tar xvzf nanopb-0.4.7-linux-x86.tar.gz
mv nanopb-0.4.7-linux-x86 nanopb-0.4.7
wget https://jpa.kapsi.fi/nanopb/download/nanopb-0.4.9-linux-x86.tar.gz
tar xvzf nanopb-0.4.9-linux-x86.tar.gz
mv nanopb-0.4.9-linux-x86 nanopb-0.4.9
cp nanopb-0.4.9/pb* ./src/
- name: Re-generate protocol buffers
run: |
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ Driver for interfacing with Meshtastic nodes over WiFi and Serial connections.

Note: This is **not** the [Meshtastic firmware](https://github.com/meshtastic/firmware) for use on a supported device with LoRa chip.

When using the Arduino IDE, install the Nanopb dependency as explained [here](https://www.dfrobot.com/blog-1161.html) under "Setting up the environment".

Author: Mike Schiraldi
2 changes: 1 addition & 1 deletion bin/regen-protos.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cd protobufs && ..\nanopb-0.4.7\generator-bin\protoc.exe --nanopb_out=-v:..\src -I=..\protobufs meshtastic\*.proto
cd protobufs && ..\nanopb-0.4.9\generator-bin\protoc.exe --experimental_allow_proto3_optional "--nanopb_out=-S.c -v:..\src" -I=..\protobufs\ ..\protobufs\meshtastic\*.proto && rm ../src/meshtastic/deviceonly.*
9 changes: 6 additions & 3 deletions bin/regen-protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

set -e

echo "This script requires https://jpa.kapsi.fi/nanopb/download/ version 0.4.7 to be located in the"
echo "This script requires https://jpa.kapsi.fi/nanopb/download/ version 0.4.9 to be located in the"
echo "firmware root directory if the following step fails, you should download the correct"
echo "prebuilt binaries for your computer into nanopb-0.4.7"
echo "prebuilt binaries for your computer into nanopb-0.4.9"

# the nanopb tool seems to require that the .options file be in the current directory!
cd protobufs
../nanopb-0.4.7/generator-bin/protoc --nanopb_out=-v:../src -I=../protobufs meshtastic/*.proto
../nanopb-0.4.9/generator-bin/protoc --experimental_allow_proto3_optional "--nanopb_out=-S.c -v:../src/" -I=../protobufs meshtastic/*.proto

# remove the device only protobuf, so we don't need std::vector
rm -rf ../src/meshtastic/deviceonly.*

#echo "Regenerating protobuf documentation - if you see an error message"
#echo "you can ignore it unless doing a new protobuf release to github."
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=Meshtastic
version=0.0.5
version=0.0.6
author=Meshtastic
maintainer=Meshtastic <[email protected]>
sentence=Driver for interfacing with Meshtastic nodes over WiFi and Serial connections
paragraph=This library allows devices to send and receive information through the Meshtastic network via the WiFi or Serial interface of one of its nodes. Note: this is not the Meshtastic firmware itself.
category=Communication
url=http://meshtastic.org
architectures=*
architectures=*
4 changes: 2 additions & 2 deletions src/Meshtastic.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <Arduino.h>
#include "meshtastic/mesh.pb.h"
#include <pb_encode.h>
#include <pb_decode.h>
#include "pb_encode.h"
#include "pb_decode.h"

// Some sane limits on a few strings that the protocol would otherwise allow to be unlimited length
#define MAX_USER_ID_LEN (sizeof(meshtastic_User().id) - 1)
Expand Down
4 changes: 3 additions & 1 deletion src/meshtastic/admin.pb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#include "meshtastic/admin.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
Expand All @@ -18,3 +18,5 @@ PB_BIND(meshtastic_NodeRemoteHardwarePinsResponse, meshtastic_NodeRemoteHardware





26 changes: 22 additions & 4 deletions src/meshtastic/admin.pb.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#ifndef PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED
#define PB_MESHTASTIC_MESHTASTIC_ADMIN_PB_H_INCLUDED
Expand All @@ -9,6 +9,7 @@
#include "meshtastic/connection_status.pb.h"
#include "meshtastic/mesh.pb.h"
#include "meshtastic/module_config.pb.h"
#include "meshtastic/device_ui.pb.h"

#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
Expand All @@ -34,7 +35,9 @@ typedef enum _meshtastic_AdminMessage_ConfigType {
/* TODO: REPLACE */
meshtastic_AdminMessage_ConfigType_SECURITY_CONFIG = 7,
/* */
meshtastic_AdminMessage_ConfigType_SESSIONKEY_CONFIG = 8
meshtastic_AdminMessage_ConfigType_SESSIONKEY_CONFIG = 8,
/* device-ui config */
meshtastic_AdminMessage_ConfigType_DEVICEUI_CONFIG = 9
} meshtastic_AdminMessage_ConfigType;

/* TODO: REPLACE */
Expand Down Expand Up @@ -171,6 +174,12 @@ typedef struct _meshtastic_AdminMessage {
/* Set time only on the node
Convenience method to set the time on the node (as Net quality) without any other position data */
uint32_t set_time_only;
/* Tell the node to send the stored ui data. */
bool get_ui_config_request;
/* Reply stored device ui data. */
meshtastic_DeviceUIConfig get_ui_config_response;
/* Tell the node to store UI data persistently. */
meshtastic_DeviceUIConfig store_ui_config;
/* Begins an edit transaction for config, module config, owner, and channel settings changes
This will delay the standard *implicit* save to the file system and subsequent reboot behavior until committed (commit_edit_settings) */
bool begin_edit_settings;
Expand Down Expand Up @@ -206,8 +215,8 @@ extern "C" {

/* Helper constants for enums */
#define _meshtastic_AdminMessage_ConfigType_MIN meshtastic_AdminMessage_ConfigType_DEVICE_CONFIG
#define _meshtastic_AdminMessage_ConfigType_MAX meshtastic_AdminMessage_ConfigType_SESSIONKEY_CONFIG
#define _meshtastic_AdminMessage_ConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ConfigType)(meshtastic_AdminMessage_ConfigType_SESSIONKEY_CONFIG+1))
#define _meshtastic_AdminMessage_ConfigType_MAX meshtastic_AdminMessage_ConfigType_DEVICEUI_CONFIG
#define _meshtastic_AdminMessage_ConfigType_ARRAYSIZE ((meshtastic_AdminMessage_ConfigType)(meshtastic_AdminMessage_ConfigType_DEVICEUI_CONFIG+1))

#define _meshtastic_AdminMessage_ModuleConfigType_MIN meshtastic_AdminMessage_ModuleConfigType_MQTT_CONFIG
#define _meshtastic_AdminMessage_ModuleConfigType_MAX meshtastic_AdminMessage_ModuleConfigType_PAXCOUNTER_CONFIG
Expand Down Expand Up @@ -267,6 +276,9 @@ extern "C" {
#define meshtastic_AdminMessage_set_fixed_position_tag 41
#define meshtastic_AdminMessage_remove_fixed_position_tag 42
#define meshtastic_AdminMessage_set_time_only_tag 43
#define meshtastic_AdminMessage_get_ui_config_request_tag 44
#define meshtastic_AdminMessage_get_ui_config_response_tag 45
#define meshtastic_AdminMessage_store_ui_config_tag 46
#define meshtastic_AdminMessage_begin_edit_settings_tag 64
#define meshtastic_AdminMessage_commit_edit_settings_tag 65
#define meshtastic_AdminMessage_factory_reset_device_tag 94
Expand Down Expand Up @@ -314,6 +326,9 @@ X(a, STATIC, ONEOF, UINT32, (payload_variant,remove_favorite_node,remove_
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,set_fixed_position,set_fixed_position), 41) \
X(a, STATIC, ONEOF, BOOL, (payload_variant,remove_fixed_position,remove_fixed_position), 42) \
X(a, STATIC, ONEOF, FIXED32, (payload_variant,set_time_only,set_time_only), 43) \
X(a, STATIC, ONEOF, BOOL, (payload_variant,get_ui_config_request,get_ui_config_request), 44) \
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,get_ui_config_response,get_ui_config_response), 45) \
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,store_ui_config,store_ui_config), 46) \
X(a, STATIC, ONEOF, BOOL, (payload_variant,begin_edit_settings,begin_edit_settings), 64) \
X(a, STATIC, ONEOF, BOOL, (payload_variant,commit_edit_settings,commit_edit_settings), 65) \
X(a, STATIC, ONEOF, INT32, (payload_variant,factory_reset_device,factory_reset_device), 94) \
Expand All @@ -339,6 +354,8 @@ X(a, STATIC, SINGULAR, BYTES, session_passkey, 101)
#define meshtastic_AdminMessage_payload_variant_set_config_MSGTYPE meshtastic_Config
#define meshtastic_AdminMessage_payload_variant_set_module_config_MSGTYPE meshtastic_ModuleConfig
#define meshtastic_AdminMessage_payload_variant_set_fixed_position_MSGTYPE meshtastic_Position
#define meshtastic_AdminMessage_payload_variant_get_ui_config_response_MSGTYPE meshtastic_DeviceUIConfig
#define meshtastic_AdminMessage_payload_variant_store_ui_config_MSGTYPE meshtastic_DeviceUIConfig

#define meshtastic_HamParameters_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, STRING, call_sign, 1) \
Expand All @@ -364,6 +381,7 @@ extern const pb_msgdesc_t meshtastic_NodeRemoteHardwarePinsResponse_msg;
#define meshtastic_NodeRemoteHardwarePinsResponse_fields &meshtastic_NodeRemoteHardwarePinsResponse_msg

/* Maximum encoded size of messages (where known) */
#define MESHTASTIC_MESHTASTIC_ADMIN_PB_H_MAX_SIZE meshtastic_AdminMessage_size
#define meshtastic_AdminMessage_size 511
#define meshtastic_HamParameters_size 31
#define meshtastic_NodeRemoteHardwarePinsResponse_size 496
Expand Down
2 changes: 1 addition & 1 deletion src/meshtastic/apponly.pb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#include "meshtastic/apponly.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
Expand Down
3 changes: 2 additions & 1 deletion src/meshtastic/apponly.pb.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#ifndef PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED
#define PB_MESHTASTIC_MESHTASTIC_APPONLY_PB_H_INCLUDED
Expand Down Expand Up @@ -54,6 +54,7 @@ extern const pb_msgdesc_t meshtastic_ChannelSet_msg;
#define meshtastic_ChannelSet_fields &meshtastic_ChannelSet_msg

/* Maximum encoded size of messages (where known) */
#define MESHTASTIC_MESHTASTIC_APPONLY_PB_H_MAX_SIZE meshtastic_ChannelSet_size
#define meshtastic_ChannelSet_size 679

#ifdef __cplusplus
Expand Down
4 changes: 3 additions & 1 deletion src/meshtastic/atak.pb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#include "meshtastic/atak.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
Expand Down Expand Up @@ -27,3 +27,5 @@ PB_BIND(meshtastic_PLI, meshtastic_PLI, AUTO)





3 changes: 2 additions & 1 deletion src/meshtastic/atak.pb.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#ifndef PB_MESHTASTIC_MESHTASTIC_ATAK_PB_H_INCLUDED
#define PB_MESHTASTIC_MESHTASTIC_ATAK_PB_H_INCLUDED
Expand Down Expand Up @@ -271,6 +271,7 @@ extern const pb_msgdesc_t meshtastic_PLI_msg;
#define meshtastic_PLI_fields &meshtastic_PLI_msg

/* Maximum encoded size of messages (where known) */
#define MESHTASTIC_MESHTASTIC_ATAK_PB_H_MAX_SIZE meshtastic_TAKPacket_size
#define meshtastic_Contact_size 242
#define meshtastic_GeoChat_size 444
#define meshtastic_Group_size 4
Expand Down
2 changes: 1 addition & 1 deletion src/meshtastic/cannedmessages.pb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#include "meshtastic/cannedmessages.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
Expand Down
3 changes: 2 additions & 1 deletion src/meshtastic/cannedmessages.pb.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#ifndef PB_MESHTASTIC_MESHTASTIC_CANNEDMESSAGES_PB_H_INCLUDED
#define PB_MESHTASTIC_MESHTASTIC_CANNEDMESSAGES_PB_H_INCLUDED
Expand Down Expand Up @@ -40,6 +40,7 @@ extern const pb_msgdesc_t meshtastic_CannedMessageModuleConfig_msg;
#define meshtastic_CannedMessageModuleConfig_fields &meshtastic_CannedMessageModuleConfig_msg

/* Maximum encoded size of messages (where known) */
#define MESHTASTIC_MESHTASTIC_CANNEDMESSAGES_PB_H_MAX_SIZE meshtastic_CannedMessageModuleConfig_size
#define meshtastic_CannedMessageModuleConfig_size 203

#ifdef __cplusplus
Expand Down
3 changes: 2 additions & 1 deletion src/meshtastic/channel.pb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#include "meshtastic/channel.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
Expand All @@ -17,3 +17,4 @@ PB_BIND(meshtastic_Channel, meshtastic_Channel, AUTO)




3 changes: 2 additions & 1 deletion src/meshtastic/channel.pb.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#ifndef PB_MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_INCLUDED
#define PB_MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_INCLUDED
Expand Down Expand Up @@ -186,6 +186,7 @@ extern const pb_msgdesc_t meshtastic_Channel_msg;
#define meshtastic_Channel_fields &meshtastic_Channel_msg

/* Maximum encoded size of messages (where known) */
#define MESHTASTIC_MESHTASTIC_CHANNEL_PB_H_MAX_SIZE meshtastic_Channel_size
#define meshtastic_ChannelSettings_size 72
#define meshtastic_Channel_size 87
#define meshtastic_ModuleSettings_size 8
Expand Down
2 changes: 1 addition & 1 deletion src/meshtastic/clientonly.pb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#include "meshtastic/clientonly.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
Expand Down
2 changes: 1 addition & 1 deletion src/meshtastic/clientonly.pb.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#ifndef PB_MESHTASTIC_MESHTASTIC_CLIENTONLY_PB_H_INCLUDED
#define PB_MESHTASTIC_MESHTASTIC_CLIENTONLY_PB_H_INCLUDED
Expand Down
15 changes: 14 additions & 1 deletion src/meshtastic/config.pb.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.7 */
/* Generated by nanopb-0.4.9 */

#include "meshtastic/config.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
Expand Down Expand Up @@ -46,6 +46,19 @@ PB_BIND(meshtastic_Config_SessionkeyConfig, meshtastic_Config_SessionkeyConfig,



















Expand Down
Loading

0 comments on commit 03f4cbc

Please sign in to comment.