Compare commits
6 Commits
c84d17a4d9
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
88fbbc103b
|
|||
|
76fe86a3bc
|
|||
| 6bf43409e4 | |||
|
2374365f0e
|
|||
|
f5f7184965
|
|||
|
|
a2eb47bc59 |
@@ -30,6 +30,17 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
#edit_config {
|
||||||
|
position: absolute;
|
||||||
|
background-color: var(--background-second);
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
/* height: 100%; */
|
||||||
|
}
|
||||||
|
#edit_config form {
|
||||||
|
margin: 40px auto;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -66,6 +77,19 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody id="clients"></tbody>
|
<tbody id="clients"></tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div id="edit_config" style="display:none">
|
||||||
|
<form>
|
||||||
|
<input type="hidden" name="boart" />
|
||||||
|
name: <input type="text" name="name" id="edit_name" /><br/>
|
||||||
|
stuur trim max: <input type="range" name="ch0_max" id="edit_ch0_max" max="8192" min="4096" /><br/>
|
||||||
|
stuur trim mid: <input type="range" name="ch0_mid" id="edit_ch0_mid" max="8192" min="0" /><br/>
|
||||||
|
stuur trim min: <input type="range" name="ch0_min" id="edit_ch0_min" max="4096" min="0" /><br/>
|
||||||
|
motor trim max: <input type="range" name="ch1_max" id="edit_ch1_max" max="8192" min="4096" /><br/>
|
||||||
|
motor trim mid: <input type="range" name="ch1_mid" id="edit_ch1_mid" max="8192" min="0" /><br/>
|
||||||
|
motor trim min: <input type="range" name="ch1_min" id="edit_ch1_min" max="4096" min="0" /><br/>
|
||||||
|
<button class="btn" onclick="updateConfig()">toepassen</button> <button class="btn" onclick="document.getElementById('edit_config').style.display = 'none'">anulleren</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<script>
|
<script>
|
||||||
const passEl = document.getElementById('pass');
|
const passEl = document.getElementById('pass');
|
||||||
@@ -174,7 +198,14 @@
|
|||||||
|
|
||||||
function getBoatLog(e)
|
function getBoatLog(e)
|
||||||
{
|
{
|
||||||
alert("loggy log");
|
// let cmd = prompt("enter command");
|
||||||
|
let boat = getDataFomEl(e.target);
|
||||||
|
// console.log("send cmd", boat, cmd);
|
||||||
|
// conn.send(passEl.value + ";sendcmd;" + boat['id'] + ";" + cmd);
|
||||||
|
|
||||||
|
conn.send(passEl.value + ";sendcmd;" + boat['id'] + ";servotrim:0");
|
||||||
|
conn.send(passEl.value + ";sendcmd;" + boat['id'] + ";servotrim:1");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function reqBoats()
|
function reqBoats()
|
||||||
@@ -307,4 +338,4 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -130,13 +130,16 @@ async def getlog(client, data):
|
|||||||
|
|
||||||
async def sendcmd(data):
|
async def sendcmd(data):
|
||||||
"""send command to boat"""
|
"""send command to boat"""
|
||||||
for b in Boats:
|
if len(data) > 3:
|
||||||
if b['id'] == data[2]:
|
for b in Boats:
|
||||||
del data[0]
|
if b['id'] == data[2]:
|
||||||
del data[1]
|
del data[2]
|
||||||
data = ";".join(data)
|
del data[1]
|
||||||
await sendToBoat(b, data)
|
del data[0]
|
||||||
return
|
print(data)
|
||||||
|
data = ";".join(data)
|
||||||
|
await sendToBoat(b, data + "\n")
|
||||||
|
return
|
||||||
|
|
||||||
async def kick_client(clientId):
|
async def kick_client(clientId):
|
||||||
"""kick a client"""
|
"""kick a client"""
|
||||||
@@ -157,7 +160,7 @@ async def on_message(message, client):
|
|||||||
data = message.replace('\n', '').split(';')
|
data = message.replace('\n', '').split(';')
|
||||||
if data[0] != client["id"]:
|
if data[0] != client["id"]:
|
||||||
print("invalid id: " + str(data[0]) + " != " + str(client["id"]))
|
print("invalid id: " + str(data[0]) + " != " + str(client["id"]))
|
||||||
else:
|
elif len(data) >= 2:
|
||||||
if data[1] == "boats":
|
if data[1] == "boats":
|
||||||
await echo_boats(client)
|
await echo_boats(client)
|
||||||
elif data[1] == "ctrl":
|
elif data[1] == "ctrl":
|
||||||
@@ -190,6 +193,8 @@ async def on_message(message, client):
|
|||||||
print("WARN: invalid command (admin): '" + data[1] + "'")
|
print("WARN: invalid command (admin): '" + data[1] + "'")
|
||||||
else:
|
else:
|
||||||
print("WARN: invalid command (" + client['id'] + "): '" + data[1] + "'")
|
print("WARN: invalid command (" + client['id'] + "): '" + data[1] + "'")
|
||||||
|
else:
|
||||||
|
print("WARN: to little arguments")
|
||||||
|
|
||||||
async def new_client(clientId, ws):
|
async def new_client(clientId, ws):
|
||||||
"""handler for every new client connection"""
|
"""handler for every new client connection"""
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ int cmd_contrl(char* line, void* cli)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// servotrim:0 410;614;819
|
||||||
int cmd_servotrim(char* line, void* cli)
|
int cmd_servotrim(char* line, void* cli)
|
||||||
{
|
{
|
||||||
uint8_t ch;
|
uint8_t ch;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#define SERVO_DUTY_MIN ( 410) // 2**13 * (1000/20000) // 1000us of the 20ms
|
#define SERVO_DUTY_MIN ( 410) // 2**13 * (1000/20000) // 1000us of the 20ms
|
||||||
#define SERVO_DUTY_MAX ( 819) // 2**13 * (2000/20000) // 2000us of the 20ms
|
#define SERVO_DUTY_MAX ( 819) // 2**13 * (2000/20000) // 2000us of the 20ms
|
||||||
// #define SERVO_DUTY_MAX (1024) // 2**13 * (2500/20000) // 2500us of the 20ms
|
// #define SERVO_DUTY_MAX (1024) // 2**13 * (2500/20000) // 2500us of the 20ms
|
||||||
#define SERVO_DUTY_MID ( 614) // 2**13 * (1500/20000) // 2500us of the 20ms
|
#define SERVO_DUTY_MID ( 614) // 2**13 * (1500/20000) // 1500us of the 20ms
|
||||||
|
|
||||||
#define SERVO_DUTY_DIFF (SERVO_DUTY_MAX - SERVO_DUTY_MIN)
|
#define SERVO_DUTY_DIFF (SERVO_DUTY_MAX - SERVO_DUTY_MIN)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user