Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Send readings over LoRaWAN #63

Open
wants to merge 99 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
0d1f2c2
added LORA folder
dustinfranco Jan 11, 2017
fa263af
added initial code including some communications, next step is migrat…
dustinfranco Jan 12, 2017
4dce4a6
initial commit of unchanged sensor code
dustinfranco Jan 12, 2017
5e3db07
stdio points to usb serial, but now using 'mDotUart.function' we can …
dustinfranco Jan 13, 2017
f0a8740
added some useful, or possibly not useful, functions
dustinfranco Jan 18, 2017
b221798
adding all dependencies as tng all dependencies as they appear relati…
dustinfranco Jan 18, 2017
281e412
added AT_EXAMPLE, the example main that has AT commands in it, but fo…
dustinfranco Jan 18, 2017
bb45a75
renamed 'mdotCode' to 'main' to reflect how it appears on the mbed IDE
dustinfranco Jan 18, 2017
38758a5
honestly cannot figure out why DS store is showing up on diff, it's i…
dustinfranco Jan 25, 2017
9c9b2ff
refactoring how we save readings
dustinfranco Feb 10, 2017
c5eb760
copy+pasted estimateSize function from valve.device.nut
dustinfranco Feb 10, 2017
82d883d
added logFreeNVMemory function, modified to fit sensor needs
dustinfranco Feb 10, 2017
f962597
added trimStordNVReadingsEvenly, modified to work for sensor
dustinfranco Feb 10, 2017
198978e
sendStoredErrors added and midified to work for sensor
dustinfranco Feb 10, 2017
8f75f6e
pushError added, no modifications needed I think
dustinfranco Feb 10, 2017
9c48ced
added saveReadingToNV, modified to work on the sensor
dustinfranco Feb 10, 2017
a13f1cf
added the constants needed to make these functions work
dustinfranco Feb 10, 2017
ea7ee4c
added saveReadingToNV, which is what the sensor always did/does
dustinfranco Feb 10, 2017
70a1972
removed a function I began working on but was replaced by a finished …
dustinfranco Feb 10, 2017
c891d62
added stored errors related stuff to nv table
dustinfranco Feb 10, 2017
ecac904
reverting a change i didnt mean to commit
dustinfranco Feb 10, 2017
3f3c078
removed a partial comment (still there in valve code)
dustinfranco Feb 10, 2017
546b602
should send stored errors from when it was offline now
dustinfranco Feb 10, 2017
40b0992
slightly reduced nv size limit, estimateSize of null returns 0, fixed…
dustinfranco Feb 11, 2017
508ab80
removed our old way of removing readings, which I don't think was eve…
dustinfranco Feb 11, 2017
710d3a8
addressed all git comments and added logFreeNVMemory into the connect…
dustinfranco Feb 11, 2017
76b8f50
removed extra space
dustinfranco Feb 11, 2017
723c74c
I think everything works how we wnt it to - but the scope gets suuuup…
dustinfranco Feb 11, 2017
76b2104
moved sensor code into a new folder
dustinfranco Feb 14, 2017
5049dee
efw should now call the valve version of efw_python if the first argu…
dustinfranco Feb 14, 2017
b625fad
now it properly pushes feature branchgit add Scripts! YESgit add Scri…
dustinfranco Feb 14, 2017
1bf2bfd
changed what I could to work for funcitonal tests, added comments tha…
dustinfranco Feb 15, 2017
2da8542
added blank files required to run functional test setup
dustinfranco Feb 15, 2017
ac3a162
renamed and reconfigured some things, it pushes to sensor_0.0.x_debug…
dustinfranco Feb 15, 2017
582f920
the device side of functional tests should be *nearly* finished
dustinfranco Feb 15, 2017
fe277ad
the device side of functional tests should be *nearly* finished
dustinfranco Feb 15, 2017
5437ba6
modified efw_python and functionalTestMode.py to work specifically fo…
dustinfranco Feb 16, 2017
042848d
updated loggly library version
dustinfranco Feb 16, 2017
e4e1e8e
deleted unused file
dustinfranco Feb 16, 2017
6488e7e
replaced the sleep calls with identical lines for testing, but we sho…
dustinfranco Feb 16, 2017
82ba90d
added actual functional tests on the agent
dustinfranco Feb 16, 2017
9d8bafc
fixed merge conflict
dustinfranco Feb 16, 2017
91d0c31
forgot to remove the <<<head from teh conflict
dustinfranco Feb 16, 2017
c4d0d78
stoppe logging something that's more or less useless
dustinfranco Feb 16, 2017
d5c7f0e
muted the tests, as of this commit tests are failing because sendResu…
dustinfranco Feb 16, 2017
ca3d53c
of all the things we DO log on the sensor, the origin of the deep sle…
dustinfranco Feb 16, 2017
3abf0c5
no longer sets up watch dog timer or runs 'the production' main
dustinfranco Feb 16, 2017
fd7f763
added 'example sequence'
dustinfranco Feb 17, 2017
9f824dd
connect success is a new thing I added
dustinfranco Feb 21, 2017
fc4e671
added connectStatus to script
dustinfranco Feb 21, 2017
335fd74
Merge branch 'feature/functional-testing-and-efw' into feature/LORA
dustinfranco Feb 21, 2017
beaeeed
AT commands work over USB comm port linked to eimp
dustinfranco Feb 24, 2017
e778276
lots of example code copy that needs to be reworked, but this sends
dustinfranco Feb 24, 2017
2ee1671
now reads uart communication as series of strings
dustinfranco Feb 24, 2017
600ad2b
got rif of 'led state' log
dustinfranco Feb 24, 2017
59a938e
added most of the functions that will control lora communications
dustinfranco Feb 24, 2017
902b722
lora config and send readings with results checking compelte
dustinfranco Feb 24, 2017
7b182a9
removed some code I used to check the output of the find() method, al…
dustinfranco Feb 24, 2017
9c6e64f
updated agent to more recent code, added http something to deal with …
dustinfranco Feb 24, 2017
04b7d49
round trip works now! time to build out specific handling for each pa…
dustinfranco Feb 25, 2017
49683d0
added a global reading (should send successfully if you send_data_jso…
dustinfranco Feb 27, 2017
b1b7d99
added functions to add readings to lora queue
dustinfranco Feb 27, 2017
fa34936
added send lora comm stuff to 'is server refresh needed' conditional
dustinfranco Feb 27, 2017
88a0341
fixed a small bug
dustinfranco Feb 27, 2017
b2b524e
added main at bottom (need to revise that), add all readings to lora …
dustinfranco Feb 28, 2017
70e045e
added the BIN file for the mdot code
dustinfranco Feb 28, 2017
268c6a0
removed some sensor libraries that are not connected on the microdeve…
dustinfranco Feb 28, 2017
f115e2a
i2c isnt working because of modifictation for lora, so I basically di…
dustinfranco Feb 28, 2017
ebcf587
added watchdog timer, and a blinkup timer ONLY on cold boot
dustinfranco Feb 28, 2017
b2eced0
added server.disconnect to save power, added a try (not a very good one)
dustinfranco Mar 1, 2017
0f95d0e
fixed a bug, added a blue light during blinkup
dustinfranco Mar 1, 2017
5d4e096
agent is possibly finished, it constructs readings from the sensor pi…
dustinfranco Mar 1, 2017
90c10d1
fixed slice call to be proper length, changed some variables and adde…
dustinfranco Mar 1, 2017
d989ddd
fixed how the reading is constructed on the agent.
dustinfranco Mar 1, 2017
cf7e938
now removes it's readings when it sends them successfully
dustinfranco Mar 1, 2017
e68e2a4
watchdog timer is now based on number of readings
dustinfranco Mar 1, 2017
cfba737
fixed a slice call and now I record the number of readings before beg…
dustinfranco Mar 1, 2017
ddd128a
agent change made to enable logging how many readings there are
dustinfranco Mar 1, 2017
8873211
fixed the sensor sample frequency
dustinfranco Mar 1, 2017
fd84378
makign a new class of comments where I mark known places we can impro…
dustinfranco Mar 1, 2017
ec41561
addressed/removed/fixed/modified ALL todo before releases
dustinfranco Mar 1, 2017
1289d01
added a todo before release and changed the send frequency to an hour…
dustinfranco Mar 1, 2017
75ee1c7
added a few more todos
dustinfranco Mar 1, 2017
eaf6340
added another todo
dustinfranco Mar 1, 2017
16b638b
added a less sophisticated version of trim stored readings evenly logic
dustinfranco Mar 1, 2017
98048b0
readded a paren I apparently deleted
dustinfranco Mar 1, 2017
934a59e
changed the trimstoredreadingsevenly to not have any inputs
dustinfranco Mar 1, 2017
7558610
made necessary modifications to send data while controlling mdot powe…
dustinfranco Mar 15, 2017
3a945a7
added green light, added initial sleep before starting loop, added au…
dustinfranco Mar 22, 2017
f60cc93
lowered transmit power
dustinfranco Mar 23, 2017
4e9b54a
only sends maximum one reading at a time, not sure why readings aren'…
dustinfranco Mar 23, 2017
193d836
added some server logs and changed the way capaciance is sent and int…
dustinfranco Mar 23, 2017
2e7dda7
used the local variable instead of doing the calculation twice
dustinfranco Mar 23, 2017
e331a76
added logic to connect and send data once every 24 hours.
dustinfranco Mar 23, 2017
7ff8e67
removed a function I began writing and abandoned
dustinfranco Mar 24, 2017
18e0640
wakereason was missing
dustinfranco Mar 24, 2017
25624a3
i2c messes up sometimes and reads out 120 degrees C and 130 humidity,…
dustinfranco Mar 24, 2017
94750f3
changed numbers back to what they should be
dustinfranco Mar 24, 2017
0ec2109
different conversion for capacitance now
dustinfranco Mar 24, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Binary file modified .DS_Store
Binary file not shown.
33 changes: 33 additions & 0 deletions Scripts/SwitchStaging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import getopt, sys
import os
from tempfile import mkstemp
from shutil import move
from os import remove, close
import os

mypath=os.path.dirname(os.path.abspath(__file__))
agentFile=mypath+"/sensor.agent.nut"
args = sys.argv;

def replace(file_path, pattern, subst):
#Create temp file
fh, abs_path = mkstemp()
with open(abs_path,'w') as new_file:
with open(file_path) as old_file:
for line in old_file:
new_file.write(line.replace(pattern, subst))
close(fh)
#Remove original file
remove(file_path)
#Move new file
move(abs_path, file_path)

def switchChoice():
o = args[1]
replace(agentFile,'logTable.env <- "Develop";','logTable.env <- "' + o + '";')
replace(agentFile,'logTable.env <- "Feature";','logTable.env <- "' + o + '";')
replace(agentFile,'logTable.env <- "Production";','logTable.env <- "' + o + '";')


# ...
switchChoice()
99 changes: 99 additions & 0 deletions Scripts/UnitTestCreation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import os
import getopt, sys
import os
from tempfile import mkstemp
from shutil import move
from os import remove, close
mypath=os.path.dirname(os.path.abspath(__file__))
agentFile=mypath+"/valve.agent.nut"
agentTests=mypath+"/valve.agent.tests.nut"
agentConcat=mypath+"/valve.agent.unit.nut"

deviceFile=mypath+"/valve.device.nut"
deviceTests=mypath+"/valve.device.tests.nut"
deviceConcat=mypath+"/valve.device.unit.nut"

#with open(agentConcat, 'w+') as fin:
# agentTestsText=fin.read()



def replace(file_path, pattern, subst):
#Create temp file
fh, abs_path = mkstemp()
with open(abs_path,'w') as new_file:
with open(file_path) as old_file:
for line in old_file:
new_file.write(line.replace(pattern, subst))
close(fh)
#Remove original file
remove(file_path)
#Move new file
move(abs_path, file_path)

errNumber = 0
errTable = ['a"','b"','c"','d"','e"','f"','g"','h"','i"']
currentfunc='"'


#Device File Editing
wholeLine=""
wholeDeviceUnitFile=""

#Simple Replace:
replace(deviceFile, "server.sleepFor", "mostRecentDeepSleepCall = ")
replace(deviceFile, "forwardPin.write(1);","")
replace(deviceFile, "controlPin.write(1);","")
replace(deviceFile, "unitTesting <- false;", "unitTesting <- true;\nthrowErrors <- 'z';\ncodeDebug <- false;\ntestDebug <- true;")
replace(deviceFile, "server.log", "if(codeDebug)server.log")
replace(deviceTests, "server.log", "if(testDebug)server.log")
replace(deviceFile, "const FIRST_X_SECONDS_TIMER =","FIRST_X_SECONDS_TIMER <-")

#Complex Insertions:
with open(deviceFile, 'r') as fin:
deviceText=fin.read()
with open(deviceTests, 'r') as fin:
deviceTests=fin.read()
for letter in deviceText:
wholeLine+=letter
if(letter=="\n"):
if(len(wholeLine)>6):
if(wholeLine[0:8]=="function"):
currentfunc = '"'+wholeLine[9:12]
print wholeLine[0:-2] + "changing to" + currentfunc
errNumber = 0
if(len(wholeLine)>4):
if(wholeLine[-5:]=="try{\n" or wholeLine[-6:]=="try {\n"):
wholeDeviceUnitFile += wholeLine
print("found a try")
wholeDeviceUnitFile += ("if(throwErrors==" + currentfunc.lower()+errTable[errNumber]+"){server.log(THISTHROWSERRORS)};\n")
errNumber += 1
else:
wholeDeviceUnitFile+=wholeLine
else:
wholeDeviceUnitFile+=wholeLine
wholeLine=""


#Agent File Editing

#Simple Replace:
replace(agentFile, '#require "Loggly.class.nut:1.0.1"','#require "Loggly.class.nut:1.0.1"\ncodeDebug <- false;\ntestDebug <- true;')
replace(agentFile, "server.log", "if(codeDebug)server.log")
replace(agentTests, "server.log", "if(testDebug)server.log")
replace(agentFile,"addLogglyDefaults(logTable){","addLogglyDefaults(logTable){\nlastLoggly = logTable;\n")

with open(agentFile, 'r') as fin:
agentText=fin.read()
with open(agentTests, 'r') as fin:
agentTests=fin.read()




with open(deviceConcat, 'w+') as fin:
fin.write(wholeDeviceUnitFile+deviceTests)
with open(agentConcat, 'w+') as fin:
fin.write(agentText+agentTests)


4 changes: 4 additions & 0 deletions Scripts/efw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if [$1 == "valve"]; then
Python /Users/dustinfranco/Edyn/firmware-valve/Scripts/efw_python.py "$*"
else [$1 == "sensor"]; then
Python /Users/dustinfranco/Edyn/firmware-sensor/Scripts/efw_python.py "$*"
Loading