Skip to content

Commit 4f06144

Browse files
authored
Fix error in initial network setting (ExpressLRS#1933)
* Fix error in initial network setting * bloody stupid python!
1 parent 3d111b4 commit 4f06144

3 files changed

Lines changed: 25 additions & 8 deletions

File tree

.github/workflows/build.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
uses: actions/checkout@v2
1313

1414
- name: Set up Python
15-
uses: actions/setup-python@v1
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.10'
1618

1719
- name: Cache pip
1820
uses: actions/cache@v2
@@ -45,7 +47,9 @@ jobs:
4547
- name: Checkout
4648
uses: actions/checkout@v2
4749
- name: Set up Python
48-
uses: actions/setup-python@v1
50+
uses: actions/setup-python@v4
51+
with:
52+
python-version: '3.10'
4953
- name: Validate target files
5054
run: |
5155
cd src
@@ -77,7 +81,9 @@ jobs:
7781
uses: actions/checkout@v2
7882

7983
- name: Set up Python
80-
uses: actions/setup-python@v1
84+
uses: actions/setup-python@v4
85+
with:
86+
python-version: '3.10'
8187

8288
- name: Cache pip
8389
uses: actions/cache@v2
@@ -172,7 +178,7 @@ jobs:
172178
runs-on: ${{ matrix.os }}
173179
steps:
174180
- uses: actions/checkout@v2
175-
- uses: actions/setup-python@v2
181+
- uses: actions/setup-python@v4
176182
with:
177183
python-version: 3.7
178184

src/html/scan.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,14 +351,15 @@ _('upload_form').addEventListener('submit', (e) => {
351351

352352
// =========================================================
353353

354-
function callback(title, msg, url, getdata) {
354+
function callback(title, msg, url, getdata, success) {
355355
return function(e) {
356356
e.stopPropagation();
357357
e.preventDefault();
358358
xmlhttp = new XMLHttpRequest();
359359
xmlhttp.onreadystatechange = function() {
360360
if (this.readyState == 4) {
361361
if (this.status == 200) {
362+
if (success) success();
362363
cuteAlert({
363364
type: 'info',
364365
title: title,
@@ -384,6 +385,9 @@ function setupNetwork(event) {
384385
if (_('nt0').checked) {
385386
callback('Set Home Network', 'An error occurred setting the home network', '/sethome?save', function() {
386387
return new FormData(_('sethome'));
388+
}, function() {
389+
_('wifi-ssid').value = _('network').value;
390+
_('wifi-password').value = _('password').value;
387391
})(event);
388392
}
389393
if (_('nt1').checked) {

src/python/serve_html.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
config = {
2323
"options": {
2424
'uid': [1,2,3,4,5,6],
25-
'wifi-on-interval': 60,
2625
"tlm-interval": 240,
2726
"fan-runtime": 30,
2827
"no-sync-on-arm": False,
@@ -31,10 +30,13 @@
3130
"rcvr-uart-baud": 400000,
3231
"rcvr-invert-tx": False,
3332
"lock-on-first-connection": True,
34-
"domain": 1
33+
"domain": 1,
34+
"wifi-on-interval": 60,
35+
"wifi-password": "w1f1-pAssw0rd",
36+
"wifi-ssid": "network-ssid"
3537
},
3638
"config": {
37-
"ssid":"ConnectedNetwork",
39+
"ssid":"network-ssid",
3840
"mode":"STA",
3941
"modelid":255,
4042
"pwm":[512,1536,2048,3584,4608],
@@ -136,6 +138,11 @@ def update_config():
136138
if (request.json['button-actions'] is not None):
137139
config['config']['button-actions'] = request.json['button-actions']
138140

141+
@route('/sethome', method='POST')
142+
def options():
143+
response.content_type = 'application/json; charset=latin9'
144+
return "Connecting to network '" + request.forms.get('network') + "', connect to http://elrs_tx.local from a browser on that network"
145+
139146
@route('/networks.json')
140147
def mode():
141148
global net_counter

0 commit comments

Comments
 (0)