Skip to content

Commit

Permalink
in lora support settings: adr, confirmed, retries
Browse files Browse the repository at this point in the history
  • Loading branch information
ftylitak committed Sep 20, 2023
1 parent ae2063d commit fcb1b50
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 12 deletions.
3 changes: 3 additions & 0 deletions insighioNode/lib/networking/lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def join(cfg, lora_keys):

modem.set_region(cfg._LORA_REGION if cfg._LORA_REGION is not None else "EU868")
modem.set_dr(cfg._LORA_DR if cfg._LORA_DR is not None else 5)
modem.set_confirm(cfg._LORA_CONFIRMED if cfg._LORA_CONFIRMED is not None else 0)
modem.set_adr(cfg._LORA_ADR if cfg._LORA_ADR is not None else 0)
modem.set_retries(cfg._LORA_TX_RETRIES if cfg._LORA_TX_RETRIES is not None else 0)

modem.set_dev_eui(lora_keys[0])
modem.set_app_eui(lora_keys[1])
Expand Down
12 changes: 12 additions & 0 deletions insighioNode/lib/networking/modem/modem_rak4270.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ def set_dr(self, dr):
(status, lines) = self.send_at_cmd('at+set_config=lora:dr:{}'.format(dr))
return status

def set_confirm(self, confirm):
(status, lines) = self.send_at_cmd('at+set_config=lora:confirm:{}'.format(1 if confirm else 0))
return status

def set_adr(self, adr):
(status, lines) = self.send_at_cmd('at+set_config=lora:adr:{}'.format(1 if adr else 0))
return status

def set_retries(self, retries):
(status, lines) = self.send_at_cmd('at+set_config=lora:send_repeat_cnt:{}'.format(retries if retries else 0))
return status

def join(self):
self.send_at_cmd('at+set_config=lora:ch_mask:8:0')
self.send_at_cmd('at+set_config=lora:ch_mask:9:0')
Expand Down
2 changes: 1 addition & 1 deletion insighioNode/web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def get(self, data):
pass

try:
del sys.modules["apps.demo_console.scenario_sdi12_utils"]
del sys.modules["apps.demo_console.scenario_advind_utils"]
except:
pass

Expand Down
21 changes: 13 additions & 8 deletions insighioNode/www/step-3-net-lora.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@
</div>
<div class="col-9 col-sm-12">
<select class="form-select" id="input-region">
<option value="AS923">AS923</option>
<option value="AS923-">AS923-4</option>
<option value="AS923-1">AS923-1</option>
<option value="AS923-2">AS923-2</option>
<option value="AS923-3">AS923-3</option>
<option value="AU915">AU915</option>
<option value="EU868">EU868</option>
<option value="US915">US915</option>
<option value="CN470">CN470</option>
<option value="EU433">EU433</option>
<option value="EU868">EU868</option>
<option value="IN865">IN865</option>
<option value="KR920">KR920</option>
<option value="US915">US915</option>
</select>
</div>
<br />
Expand Down Expand Up @@ -126,22 +131,22 @@
var confirmed = Cookies.get("lora-confirmed")

setElemValue('input-region', Cookies.get('lora-region'), "EU868")
setElemValue('input-dr', Cookies.get('lora-adr'), 5)
setElemValue('input-dr', Cookies.get('lora-dr'), 5)
setElemValue('input-retries', Cookies.get('lora-retries'), 1)

document.getElementById('input-adr').checked = adr !== undefined ? adr : true
document.getElementById('input-confirmed').checked = confirmed !== undefined ? confirmed : false
setElemValueBool('input-adr', strToJSValue(Cookies.get("lora-adr")), true)
setElemValueBool('input-confirmed', strToJSValue(Cookies.get("lora-confirmed")), true)

detectBoardChange(enableNavigationButtons)
}

function clearCookies() {
Cookies.remove('lora-region')
Cookies.remove('network')
Cookies.remove('lora-adr')
Cookies.remove('lora-confirmed')
Cookies.remove('lora-dr')
Cookies.remove('lora-region')
Cookies.remove('lora-retries')
Cookies.remove('network')
Cookies.remove('protocol')
}

Expand Down
13 changes: 10 additions & 3 deletions insighioNode/www/step-5-measurements.html
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@
Cookies.set('meas-pcnt-1-cnt-on-rising', document.getElementById('ins-esp-gen-pcnt-1-cnt-on').value === "rising")
Cookies.set('meas-pcnt-1-multiplier', document.getElementById('ins-esp-gen-pcnt-1-multiplier').value)

redirectTo("step-5-4-measurement-naming.html")
redirectoToMeasurementNaming()
}
else if (elementIsVisible("shield-scale-options")) {
Cookies.set('selected-shield', shieldNamePerTab["shield-scale-options"])
Expand All @@ -551,7 +551,7 @@
if (!isChecked('input-scale-enabled')) {
Cookies.set('meas-scale-offset', 0)
Cookies.set('meas-scale-scale', 1)
redirectTo("step-5-4-measurement-naming.html")
redirectoToMeasurementNaming()
}
else {
var scale = Cookies.get("meas-scale-scale")
Expand Down Expand Up @@ -585,12 +585,19 @@
if (elementIsVisible('input-s1-sensor-a-d-p3-trans-div'))
Cookies.set('meas-sensor-a-d-p3-t', document.getElementById('input-s1-sensor-a-d-p3-t').value)

redirectTo("step-5-4-measurement-naming.html")
redirectoToMeasurementNaming()
}

enableNavigationButtons()
}

function redirectoToMeasurementNaming(){
if(Cookies.get('network') !== "lora")
redirectTo("step-5-4-measurement-naming.html")
else
redirectTo("step-6-timing.html")
}

function boardChanged(evt, boardDivId) {
console.log("boardChanged: ", boardDivId)
var i, tabcontent, tablinks;
Expand Down

0 comments on commit fcb1b50

Please sign in to comment.