Commit 256c343e authored by Arnaud WATLET's avatar Arnaud WATLET
Browse files

Fixes bugs on run.sh for start on reboot and index.html merge issues

Showing with 4 additions and 50 deletions
+4 -50
...@@ -20,7 +20,7 @@ OHMPI_CONFIG = { ...@@ -20,7 +20,7 @@ OHMPI_CONFIG = {
CONTROL_CONFIG = { CONTROL_CONFIG = {
'tcp_port': 5555, 'tcp_port': 5555,
'interface': 'http_interface.py' # 'mqtt_interface' 'interface': 'mqtt_interface.py' # 'mqtt_interface'
} }
# Execution logging configuration # Execution logging configuration
EXEC_LOGGING_CONFIG = { EXEC_LOGGING_CONFIG = {
......
...@@ -142,11 +142,7 @@ ...@@ -142,11 +142,7 @@
// useful functions // useful functions
function sendCommand(query, callback=null) { function sendCommand(query, callback=null) {
<<<<<<< HEAD
// dic in the form: {'cmd': X, ...} as JSON // dic in the form: {'cmd': X, ...} as JSON
=======
// dic in the form: {'command': X, ...} as JSON
>>>>>>> a52ac9e5e0984f701ed4e4c3a437d7ae4cf0673a
if (callback == null) { if (callback == null) {
function callback(x) { function callback(x) {
console.log('default callback:', x) console.log('default callback:', x)
...@@ -167,11 +163,7 @@ ...@@ -167,11 +163,7 @@
// start button // start button
function startBtnFunc() { function startBtnFunc() {
<<<<<<< HEAD
sendCommand('{"cmd": "start"}', function(x) { sendCommand('{"cmd": "start"}', function(x) {
=======
sendCommand('{"command": "start"}', function(x) {
>>>>>>> a52ac9e5e0984f701ed4e4c3a437d7ae4cf0673a
console.log(x['status']) console.log(x['status'])
if (x['status'] == 'running') { if (x['status'] == 'running') {
output.innerHTML = 'Status: measuring...' output.innerHTML = 'Status: measuring...'
...@@ -183,11 +175,7 @@ ...@@ -183,11 +175,7 @@
// stop button // stop button
function stopBtnFunc() { function stopBtnFunc() {
<<<<<<< HEAD
sendCommand('{"cmd": "stop"}', function(x) { sendCommand('{"cmd": "stop"}', function(x) {
=======
sendCommand('{"command": "stop"}', function(x) {
>>>>>>> a52ac9e5e0984f701ed4e4c3a437d7ae4cf0673a
output.innerHTML = 'Status: ' + x['status'] output.innerHTML = 'Status: ' + x['status']
clearInterval(interv) clearInterval(interv)
getData() getData()
...@@ -209,17 +197,10 @@ ...@@ -209,17 +197,10 @@
// define callback to send settigs to Pi // define callback to send settigs to Pi
function configCallback() { function configCallback() {
sendCommand(JSON.stringify({ sendCommand(JSON.stringify({
<<<<<<< HEAD
'cmd': 'update_settings', 'cmd': 'update_settings',
'config': formVals 'config': formVals
}), function(x) { }), function(x) {
console.log('update_settings', x) console.log('update_settings', x)
=======
'command': 'setConfig',
'config': formVals
}), function(x) {
console.log('setconfig:', x)
>>>>>>> a52ac9e5e0984f701ed4e4c3a437d7ae4cf0673a
}) })
} }
...@@ -370,11 +351,7 @@ ...@@ -370,11 +351,7 @@
// run RS check // run RS check
function rsBtnFunc() { function rsBtnFunc() {
<<<<<<< HEAD
sendCommand('{"cmd": "rsCheck"}', function (res) { sendCommand('{"cmd": "rsCheck"}', function (res) {
=======
sendCommand('{"command": "rsCheck"}', function (res) {
>>>>>>> a52ac9e5e0984f701ed4e4c3a437d7ae4cf0673a
// update the bar plot // update the bar plot
rsdata.push({ rsdata.push({
x: res['data']['AB'], x: res['data']['AB'],
...@@ -399,11 +376,7 @@ ...@@ -399,11 +376,7 @@
// getData // getData
function getData() { function getData() {
sendCommand(JSON.stringify({ sendCommand(JSON.stringify({
<<<<<<< HEAD
'cmd': 'getData', 'cmd': 'getData',
=======
'command': 'getData',
>>>>>>> a52ac9e5e0984f701ed4e4c3a437d7ae4cf0673a
'surveyNames': Object.keys(data).slice(0, -1) 'surveyNames': Object.keys(data).slice(0, -1)
// last survey is often partial so we download it again // last survey is often partial so we download it again
}), function(ddic) { }), function(ddic) {
...@@ -524,11 +497,7 @@ ...@@ -524,11 +497,7 @@
// remove data // remove data
function removeDataBtnFunc() { function removeDataBtnFunc() {
<<<<<<< HEAD
sendCommand('{"cmd": "removeData"}',function(x) { sendCommand('{"cmd": "removeData"}',function(x) {
=======
sendCommand('{"command": "removeData"}',function(x) {
>>>>>>> a52ac9e5e0984f701ed4e4c3a437d7ae4cf0673a
data = {} data = {}
output.innerHTML = 'Status: ' + x['status'] + ' (all data cleared)' output.innerHTML = 'Status: ' + x['status'] + ' (all data cleared)'
console.log('all data removed') console.log('all data removed')
...@@ -539,11 +508,7 @@ ...@@ -539,11 +508,7 @@
// shutdown Pi // shutdown Pi
function shutdownBtnFunc() { function shutdownBtnFunc() {
<<<<<<< HEAD
sendCommand('{"cmd": "shutdown"}', function(x) { sendCommand('{"cmd": "shutdown"}', function(x) {
=======
sendCommand('{"command": "shutdown"}', function(x) {
>>>>>>> a52ac9e5e0984f701ed4e4c3a437d7ae4cf0673a
console.log('shuting down...') console.log('shuting down...')
}) })
} }
...@@ -552,11 +517,7 @@ ...@@ -552,11 +517,7 @@
// restart Pi // restart Pi
function restartBtnFunc() { function restartBtnFunc() {
<<<<<<< HEAD
sendCommand('{"cmd": "restart"}', function(x) { sendCommand('{"cmd": "restart"}', function(x) {
=======
sendCommand('{"command": "restart"}', function(x) {
>>>>>>> a52ac9e5e0984f701ed4e4c3a437d7ae4cf0673a
console.log('rebooting...') console.log('rebooting...')
}) })
} }
...@@ -565,11 +526,7 @@ ...@@ -565,11 +526,7 @@
// invert data // invert data
// function invertBtnFunc() { // function invertBtnFunc() {
<<<<<<< HEAD
// sendCommand('{"cmd": "invert"}', function(x) { // sendCommand('{"cmd": "invert"}', function(x) {
=======
// sendCommand('{"command": "invert"}', function(x) {
>>>>>>> a52ac9e5e0984f701ed4e4c3a437d7ae4cf0673a
// console.log('inversion results', x) // console.log('inversion results', x)
// }) // })
// } // }
...@@ -578,11 +535,7 @@ ...@@ -578,11 +535,7 @@
// download data // download data
function downloadBtnFunc() { function downloadBtnFunc() {
<<<<<<< HEAD
sendCommand('{"cmd": "download"}', function(x) { sendCommand('{"cmd": "download"}', function(x) {
=======
sendCommand('{"command": "download"}', function(x) {
>>>>>>> a52ac9e5e0984f701ed4e4c3a437d7ae4cf0673a
let dwl = document.getElementById('download') let dwl = document.getElementById('download')
dwl.setAttribute('href', serverUrl + '/data.zip') dwl.setAttribute('href', serverUrl + '/data.zip')
dwl.setAttribute('download', 'data.zip') dwl.setAttribute('download', 'data.zip')
......
...@@ -11,7 +11,6 @@ def on_message(client, userdata, message): ...@@ -11,7 +11,6 @@ def on_message(client, userdata, message):
# Send the command # Send the command
print(f'Sending command {message.payload.decode("utf-8")}') print(f'Sending command {message.payload.decode("utf-8")}')
<<<<<<< HEAD
socket.send(message.payload) socket.send(message.payload)
# Get the reply # Get the reply
......
#!bin/bash #!bin/bash
source ./ohmpy/bin/activate cd /home/pi/OhmPi
source /home/pi/OhmPi/ohmpy/bin/activate
python ohmpi.py python ohmpi.py
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment