Skip to content

Commit

Permalink
Merge pull request #1 from meshtastic/master
Browse files Browse the repository at this point in the history
merge from original repository
  • Loading branch information
Noki committed Dec 21, 2020
2 parents 62a8c96 + a47fcda commit 09cc0a8
Show file tree
Hide file tree
Showing 112 changed files with 3,334 additions and 2,937 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ Thumbs.db
.cproject
.idea/*
.vagrant

nanopb*
flash.uf2
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"string_view": "cpp",
"cassert": "cpp",
"iterator": "cpp",
"shared_mutex": "cpp"
"shared_mutex": "cpp",
"iostream": "cpp"
},
"cSpell.words": [
"Blox",
Expand Down
12 changes: 8 additions & 4 deletions bin/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

set -e

source bin/version.sh
VERSION=`bin/buildinfo.py`

COUNTRIES="US EU433 EU865 CN JP ANZ KR"
#COUNTRIES=US
#COUNTRIES=CN

BOARDS_ESP32="tlora-v2 tlora-v1 tlora-v2-1-1.6 tbeam heltec tbeam0.7"
# BOARDS_ESP32=tbeam
#BOARDS_ESP32=tbeam

# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine
BOARDS_NRF52="lora-relay-v1"
Expand Down Expand Up @@ -87,8 +87,12 @@ platformio lib update
do_boards "$BOARDS_ESP32" "false"
do_boards "$BOARDS_NRF52" "true"

echo "Building SPIFFS for ESP32 targets"
pio run --environment tbeam -t buildfs
cp .pio/build/tbeam/spiffs.bin $OUTDIR/bins/universal/spiffs-$VERSION.bin

# keep the bins in archive also
cp $OUTDIR/bins/firmware* $OUTDIR/elfs/firmware* $OUTDIR/bins/universal/firmware* $OUTDIR/elfs/universal/firmware* $ARCHIVEDIR
cp $OUTDIR/bins/firmware* $OUTDIR/bins/universal/spiffs* $OUTDIR/elfs/firmware* $OUTDIR/bins/universal/firmware* $OUTDIR/elfs/universal/firmware* $ARCHIVEDIR

echo Updating android bins $OUTDIR/forandroid
rm -rf $OUTDIR/forandroid
Expand All @@ -109,6 +113,6 @@ XML

echo Generating $ARCHIVEDIR/firmware-$VERSION.zip
rm -f $ARCHIVEDIR/firmware-$VERSION.zip
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $OUTDIR/bins/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh bin/device-update.sh
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $ARCHIVEDIR/spiffs-$VERSION.bin $OUTDIR/bins/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh bin/device-update.sh

echo BUILT ALL
11 changes: 11 additions & 0 deletions bin/buildinfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python3
import configparser

config = configparser.RawConfigParser()
config.read('version.properties')

version = dict(config.items('VERSION'))

verStr = "{}.{}.{}".format(version["major"], version["minor"], version["build"])

print(f"{verStr}")
3 changes: 3 additions & 0 deletions bin/device-install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

set -e

# Usage info
show_help() {
cat << EOF
Expand Down Expand Up @@ -36,6 +38,7 @@ if [ -f "${FILENAME}" ]; then
echo "Trying to flash ${FILENAME}, but first erasing and writing system information"
esptool.py --baud 921600 erase_flash
esptool.py --baud 921600 write_flash 0x1000 system-info.bin
esptool.py --baud 921600 write_flash 0x00390000 spiffs-*.bin
esptool.py --baud 921600 write_flash 0x10000 ${FILENAME}
else
echo "Invalid file: ${FILENAME}"
Expand Down
16 changes: 16 additions & 0 deletions bin/platformio-custom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Import("projenv")

import configparser
prefsLoc = projenv["PROJECT_DIR"] + "/version.properties"
config = configparser.RawConfigParser()
config.read(prefsLoc)
version = dict(config.items('VERSION'))
verStr = "{}.{}.{}".format(version["major"], version["minor"], version["build"])

print(f"Using meshtastic platform-custom.py, firmare version {verStr}")

# General options that are passed to the C and C++ compilers
projenv.Append(CCFLAGS=[
f"-DAPP_VERSION={verStr}"
])
2 changes: 1 addition & 1 deletion bin/program-release-tbeam.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

set -e

source bin/version.sh
VERSION=`bin/buildinfo.py`

esptool.py --baud 921600 write_flash 0x10000 release/latest/bins/firmware-tbeam-US-$VERSION.bin
6 changes: 6 additions & 0 deletions bin/program-release-universal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

set -e

source bin/version.sh

esptool.py --baud 921600 write_flash 0x10000 release/latest/bins/universal/firmware-tbeam-$VERSION.bin
13 changes: 11 additions & 2 deletions bin/regen-protos.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#!/bin/bash

echo "This script requires https://jpa.kapsi.fi/nanopb/download/ version 0.4.1"
set -e

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

# the nanopb tool seems to require that the .options file be in the current directory!
cd proto
../../nanopb-0.4.1-linux-x86/generator-bin/protoc --nanopb_out=-v:../src/mesh -I=../proto mesh.proto
../nanopb-0.4.4/generator-bin/protoc --nanopb_out=-v:../src/mesh -I=../proto *.proto

echo "Regenerating protobuf documentation - if you see an error message"
echo "you can ignore it unless doing a new protobuf release to github."
bin/regen-docs.sh
3 changes: 0 additions & 3 deletions bin/version.sh

This file was deleted.

8 changes: 4 additions & 4 deletions boards/nrf52840_dk_modified.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v6.ld"
"ldscript": "nrf52840_s113_v7.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
Expand All @@ -16,9 +16,9 @@
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS140",
"sd_name": "s140",
"sd_version": "6.1.1",
"sd_flags": "-DS113",
"sd_name": "s113",
"sd_version": "7.2.0",
"sd_fwid": "0x00B6"
},
"bootloader": {
Expand Down
43 changes: 43 additions & 0 deletions data/static/basic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
var meshtasticClient;
var connectionOne;


// Important: the connect action must be called from a user interaction (e.g. button press), otherwise the browsers won't allow the connect
function connect() {

// Create new connection
var httpconn = new meshtasticjs.IHTTPConnection();

// Set connection params
let sslActive;
if (window.location.protocol === 'https:') {
sslActive = true;
} else {
sslActive = false;
}
let deviceIp = window.location.hostname; // Your devices IP here


// Add event listeners that get called when a new packet is received / state of device changes
httpconn.addEventListener('fromRadio', function (packet) { console.log(packet) });

// Connect to the device async, then send a text message
httpconn.connect(deviceIp, sslActive)
.then(result => {

alert('device has been configured')
// This gets called when the connection has been established
// -> send a message over the mesh network. If no recipient node is provided, it gets sent as a broadcast
return httpconn.sendText('meshtastic is awesome');

})
.then(result => {

// This gets called when the message has been sucessfully sent
console.log('Message sent!');
})

.catch(error => { console.log(error); });

}

18 changes: 18 additions & 0 deletions data/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<html class="no-js" lang="">

<head>
<meta charset="utf-8">
<title></title>

<script src="/static/meshtastic.js"></script>
<script src="/static/basic.js"></script>
</head>

<body>

<button id="connect_button" onclick="connect()">Connect to Meshtastic device</button>

</body>

</html>
Binary file added data/static/meshtastic.js.gz
Binary file not shown.

0 comments on commit 09cc0a8

Please sign in to comment.