From 44f9d8ce7b09ac660be74d32e811567f9d4231ea Mon Sep 17 00:00:00 2001
From: jc4419 <60656643+jc4419@users.noreply.github.com>
Date: Sat, 12 Jun 2021 04:18:04 +0400
Subject: [PATCH] Removed redundant leftover code from previous versions.
Tweaked some coloring and formatting(again). Added the 'Command Buffer'
section. Added the JSON format for sending data, yet to be implemented.
---
Control/data/index.html | 136 ++++++++++++++--------------------------
1 file changed, 47 insertions(+), 89 deletions(-)
diff --git a/Control/data/index.html b/Control/data/index.html
index 53242ae..592791d 100644
--- a/Control/data/index.html
+++ b/Control/data/index.html
@@ -25,6 +25,16 @@
margin: 0px;
}
+ #command_space {
+ width:100%;
+ height: 200px;
+ line-height: normal;
+ overflow: auto;
+ background-color: rgb(248, 248, 248);
+ color: black;
+ border: 1px solid black;
+ }
+
meter {
width: 100%;
height: 40px;
@@ -48,7 +58,7 @@
text-decoration: none;
outline: none;
color: rgb(255, 255, 255);
- background-color: #161616;
+ background-color: #222222;
border: none;
border-radius: 5px;
box-shadow: 0 3px rgb(161, 161, 161);
@@ -59,15 +69,9 @@
}
button:active {
- background-color: #107C10;
+ background-color: #349134;
box-shadow: 0 3px rgb(161, 161, 161);
- transform: translateY(4px);
- }
-
- .pressed {
- background-color: #107C10;
- box-shadow: 0 5px rgb(161, 161, 161);
- transform: translateY(4px);
+ transform: translateY(1px);
}
.clearfix::after {
@@ -83,6 +87,7 @@
var command_id = 0;
var mode = 0;
var reqHeading = 0;
+ var reqDistance = 0;
var reqSpeed = 0;
var reqCharge = 0;
@@ -124,81 +129,27 @@
}
function send_data() {
- var raw_data = '{"MVM_F":' + MVM_F_status + ',"MVM_L":' + MVM_L_status + ',"MVM_R":' + MVM_R_status + ',"MVM_B":' + MVM_B_status + '}';
+ var raw_data = '{"Cid":' + command_id + ',"mode":' + mode + ',"rH":' + reqHeading + ',"rD":' + reqDistance + ',"rS":' + reqSpeed + ',"rC":' + reqCharge + '}';
connection.send(raw_data);
console.log(raw_data);
}
+ function echoCommandbuf() {
+ document.getElementById("command_buffer").innerHTML += '[' + command_id + '] ' + document.getElementById("commandInput").value + "
";
+ cIdIncrement();
+ document.getElementById("commandInput").value = "";
+ console.log('test');
+ }
+
function cIdIncrement() {
command_id++;
}
- function left_pressed() {
- MVM_L_status = 1;
- send_data();
- }
- function left_unpressed() {
- MVM_L_status = 0;
- send_data();
- }
- function up_pressed() {
- MVM_F_status = 1;
- send_data();
- }
- function up_unpressed() {
- MVM_F_status = 0;
- send_data();
- }
- function right_pressed() {
- MVM_R_status = 1;
- send_data();
- }
- function right_unpressed() {
- MVM_R_status = 0;
- send_data();
- }
- function down_pressed() {
- MVM_B_status = 1;
- send_data();
- }
- function down_unpressed() {
- MVM_B_status = 0;
- send_data();
- }
- var timer = null;
- function up_mouseDown() {
- timer = setInterval(up_pressed, 100);
- }
- function up_mouseUp() {
- clearInterval(timer);
- up_unpressed();
- }
- function down_mouseDown() {
- timer = setInterval(down_pressed, 100);
- }
- function down_mouseUp() {
- clearInterval(timer);
- down_unpressed();
- }
- function right_mouseDown() {
- timer = setInterval(right_pressed, 100);
- }
- function right_mouseUp() {
- clearInterval(timer);
- right_unpressed();
- }
- function left_mouseDown() {
- timer = setInterval(left_pressed, 100);
- }
- function left_mouseUp() {
- clearInterval(timer);
- left_unpressed();
- }
@@ -215,18 +166,20 @@
Command Buffer |
+
+
-
-
+
+
|
Main |
- |
+ |
|
- |
+ |
|
@@ -255,21 +208,13 @@
|
-
|
-
-
+
+
+
+
+
+
|
|
|
+
+
+
+
+
+ |
| | |