initial release ready
This commit is contained in:
Executable
+78
@@ -0,0 +1,78 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# check_version.sh -- verify the library version is consistent and released.
|
||||||
|
#
|
||||||
|
# A read-only sanity check (it changes nothing). It confirms the version is the
|
||||||
|
# same in all three places it's declared:
|
||||||
|
#
|
||||||
|
# * library.properties version=X.Y.Z (Arduino Library Manager)
|
||||||
|
# * library.json "version": "X.Y.Z" (PlatformIO Registry)
|
||||||
|
# * src/meshcore_companion.h MESHCORE_COMPANION_VERSION "X.Y.Z"
|
||||||
|
#
|
||||||
|
# ...and that a matching git tag (vX.Y.Z or X.Y.Z) exists. Run it before tagging
|
||||||
|
# a release. Exit status is non-zero if anything is inconsistent or untagged.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
set -u
|
||||||
|
cd "$(dirname "$0")" || exit 2
|
||||||
|
|
||||||
|
ok() { printf ' \033[32mok\033[0m %s\n' "$*"; }
|
||||||
|
bad() { printf ' \033[31mFAIL\033[0m %s\n' "$*"; }
|
||||||
|
note() { printf ' %s\n' "$*"; }
|
||||||
|
|
||||||
|
prop_ver=$(sed -nE 's/^version=([^[:space:]]+).*/\1/p' library.properties | tr -d '\r' | head -1)
|
||||||
|
json_ver=$(sed -nE 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/p' library.json | head -1)
|
||||||
|
hdr_ver=$(sed -nE 's/.*MESHCORE_COMPANION_VERSION[[:space:]]+"([^"]+)".*/\1/p' src/meshcore_companion.h | head -1)
|
||||||
|
|
||||||
|
printf 'Declared versions:\n'
|
||||||
|
printf ' library.properties : %s\n' "${prop_ver:-<not found>}"
|
||||||
|
printf ' library.json : %s\n' "${json_ver:-<not found>}"
|
||||||
|
printf ' meshcore_companion.h : %s\n' "${hdr_ver:-<not found>}"
|
||||||
|
printf '\nChecks:\n'
|
||||||
|
|
||||||
|
fail=0
|
||||||
|
|
||||||
|
# 1) all three present and identical
|
||||||
|
if [ -z "$prop_ver" ] || [ -z "$json_ver" ] || [ -z "$hdr_ver" ]; then
|
||||||
|
bad "could not read a version from every source"
|
||||||
|
fail=1
|
||||||
|
elif [ "$prop_ver" = "$json_ver" ] && [ "$json_ver" = "$hdr_ver" ]; then
|
||||||
|
ok "all three versions match ($prop_ver)"
|
||||||
|
else
|
||||||
|
bad "versions disagree (properties=$prop_ver json=$json_ver header=$hdr_ver)"
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
ver="$prop_ver"
|
||||||
|
|
||||||
|
# 2) a matching git tag exists (vX.Y.Z or X.Y.Z)
|
||||||
|
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
||||||
|
bad "not a git repository -- cannot check for a release tag"
|
||||||
|
fail=1
|
||||||
|
elif [ -z "$ver" ]; then
|
||||||
|
bad "no version to match a tag against"
|
||||||
|
fail=1
|
||||||
|
else
|
||||||
|
tag=""
|
||||||
|
for cand in "v$ver" "$ver"; do
|
||||||
|
if git rev-parse -q --verify "refs/tags/$cand" >/dev/null 2>&1; then tag="$cand"; break; fi
|
||||||
|
done
|
||||||
|
if [ -n "$tag" ]; then
|
||||||
|
ok "git tag '$tag' exists"
|
||||||
|
if [ "$(git rev-list -n1 "$tag")" != "$(git rev-parse HEAD)" ]; then
|
||||||
|
note "(tag '$tag' is not on the current HEAD -- fine if you've moved on since the release)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
bad "no git tag 'v$ver' or '$ver' -- create one to release: git tag v$ver"
|
||||||
|
fail=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '\n'
|
||||||
|
if [ "$fail" -eq 0 ]; then
|
||||||
|
printf '\033[32mVersion %s is consistent and tagged.\033[0m\n' "$ver"
|
||||||
|
else
|
||||||
|
printf '\033[31mVersion check failed.\033[0m\n'
|
||||||
|
fi
|
||||||
|
exit "$fail"
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* config.h — user-tunable settings for the AutoProvision example.
|
||||||
|
*
|
||||||
|
* Pins and the radio region default here but are normally set per board in
|
||||||
|
* platformio.ini build_flags; the #ifndef guards let either win. The identity,
|
||||||
|
* channel and echo strings are plain constants — edit them for your setup.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
#ifndef AUTOPROVISION_CONFIG_H
|
||||||
|
#define AUTOPROVISION_CONFIG_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
// --- Host UART to the companion (override per board in platformio.ini) ---
|
||||||
|
#ifndef UART_RX_PIN
|
||||||
|
#define UART_RX_PIN 17 // host RX <- companion TX
|
||||||
|
#endif
|
||||||
|
#ifndef UART_TX_PIN
|
||||||
|
#define UART_TX_PIN 18 // host TX -> companion RX
|
||||||
|
#endif
|
||||||
|
#ifndef UART_BAUD
|
||||||
|
#define UART_BAUD 115200
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// --- Radio region: AU narrow band (override in platformio.ini build_flags) ---
|
||||||
|
#ifndef LORA_FREQ
|
||||||
|
#define LORA_FREQ 916.575 // MHz
|
||||||
|
#endif
|
||||||
|
#ifndef LORA_BW
|
||||||
|
#define LORA_BW 62.5 // kHz
|
||||||
|
#endif
|
||||||
|
#ifndef LORA_SF
|
||||||
|
#define LORA_SF 7
|
||||||
|
#endif
|
||||||
|
#ifndef LORA_CR
|
||||||
|
#define LORA_CR 8
|
||||||
|
#endif
|
||||||
|
#ifndef LORA_TX_POWER
|
||||||
|
#define LORA_TX_POWER 20 // dBm
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// --- Identity + channel to provision ---
|
||||||
|
static const char* NODE_NAME = "auto-host";
|
||||||
|
static const uint8_t CHANNEL_IDX = 2;
|
||||||
|
static const char* CHANNEL_NAME = "auto";
|
||||||
|
static const char* CHANNEL_PSK_HEX = "000102030405060708090a0b0c0d0e0f"; // replace
|
||||||
|
|
||||||
|
static const char* HELLO_TEXT = "hello";
|
||||||
|
static const char* REPLY_TEXT = "hi there, auto-host here";
|
||||||
|
|
||||||
|
#endif // AUTOPROVISION_CONFIG_H
|
||||||
@@ -24,43 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "MeshCoreCompanion.h"
|
#include "MeshCoreCompanion.h"
|
||||||
|
#include "config.h" // pins, region, identity/channel — edit there
|
||||||
// --- Host UART to the companion (set in platformio.ini build_flags) ---
|
|
||||||
#ifndef UART_RX_PIN
|
|
||||||
#define UART_RX_PIN 17 // host RX <- companion TX
|
|
||||||
#endif
|
|
||||||
#ifndef UART_TX_PIN
|
|
||||||
#define UART_TX_PIN 18 // host TX -> companion RX
|
|
||||||
#endif
|
|
||||||
#ifndef UART_BAUD
|
|
||||||
#define UART_BAUD 115200
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- Radio region: AU narrow band (normally set in platformio.ini build_flags) ---
|
|
||||||
#ifndef LORA_FREQ
|
|
||||||
#define LORA_FREQ 916.575 // MHz
|
|
||||||
#endif
|
|
||||||
#ifndef LORA_BW
|
|
||||||
#define LORA_BW 62.5 // kHz
|
|
||||||
#endif
|
|
||||||
#ifndef LORA_SF
|
|
||||||
#define LORA_SF 7
|
|
||||||
#endif
|
|
||||||
#ifndef LORA_CR
|
|
||||||
#define LORA_CR 8
|
|
||||||
#endif
|
|
||||||
#ifndef LORA_TX_POWER
|
|
||||||
#define LORA_TX_POWER 20 // dBm
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// --- Identity + channel to provision ---
|
|
||||||
static const char* NODE_NAME = "auto-host";
|
|
||||||
static const uint8_t CHANNEL_IDX = 2;
|
|
||||||
static const char* CHANNEL_NAME = "auto";
|
|
||||||
static const char* CHANNEL_PSK_HEX = "000102030405060708090a0b0c0d0e0f"; // replace
|
|
||||||
|
|
||||||
static const char* HELLO_TEXT = "hello";
|
|
||||||
static const char* REPLY_TEXT = "hi there, auto-host here";
|
|
||||||
|
|
||||||
MeshCoreCompanion mc(Serial1);
|
MeshCoreCompanion mc(Serial1);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
"srcFilter": ["+<*.c>", "+<*.cpp>"]
|
"srcFilter": ["+<*.c>", "+<*.cpp>"]
|
||||||
},
|
},
|
||||||
"examples": [
|
"examples": [
|
||||||
|
{ "name": "AutoProvision", "base": "examples/AutoProvision", "files": ["platformio.ini", "src/main.cpp", "src/config.h"] },
|
||||||
{ "name": "SensorChannelBridge", "base": "examples/SensorChannelBridge", "files": ["SensorChannelBridge.ino"] }
|
{ "name": "SensorChannelBridge", "base": "examples/SensorChannelBridge", "files": ["SensorChannelBridge.ino"] }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,10 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Library version. Keep in sync with library.json and library.properties;
|
||||||
|
* check_version.sh verifies all three match and that a git tag exists. */
|
||||||
|
#define MESHCORE_COMPANION_VERSION "0.2.0"
|
||||||
|
|
||||||
/* ---- Compile-time sizing (override before including if you need more) ---- */
|
/* ---- Compile-time sizing (override before including if you need more) ---- */
|
||||||
#ifndef MC_MAX_PAYLOAD
|
#ifndef MC_MAX_PAYLOAD
|
||||||
#define MC_MAX_PAYLOAD 255 /* largest companion payload we will buffer */
|
#define MC_MAX_PAYLOAD 255 /* largest companion payload we will buffer */
|
||||||
|
|||||||
Reference in New Issue
Block a user