Browse Source

ui finished, new wifi name ...

master
Ondřej Hruška 6 years ago
parent
commit
e0332e08f4
  1. 2
      html/css/app.css
  2. BIN
      html/img/slider.png
  3. 2
      html/js/all.js
  4. 13
      html/pages/home.tpl
  5. 6
      html/pages/wifi.tpl
  6. 4
      html_src/_start.php
  7. 2
      html_src/css/app.css
  8. BIN
      html_src/img/slider.png
  9. 59
      html_src/js-src/page_home.js
  10. 2
      html_src/js/all.js
  11. 11
      html_src/page_home.php
  12. 32
      html_src/sass/pages/_home.scss
  13. 2
      user/user_main.c

2
html/css/app.css

File diff suppressed because one or more lines are too long

BIN
html/img/slider.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

2
html/js/all.js

File diff suppressed because one or more lines are too long

13
html/pages/home.tpl

@ -19,15 +19,20 @@
<div id="outer">
<nav id="menu">
<div id="brand" onclick="$('#menu').toggleClass('expanded')">WiFi Demo</div>
<a href="/home" class="selected">Home</a><a href="/wifi">WiFi config</a></nav>
<a href="/home" class="selected">Home</a></nav>
<div id="content">
<img src="/img/loader.gif" alt="Loading…" id="loader">
<h1>Motor Control</h1>
<h1>Ovládání motoru</h1>
<div class="Box center">
<a class="button btn-blue" id="btn-rev">REV</a><span style="display:inline-block;width:2em"></span>
<a class="button btn-blue" id="btn-fwd">FWD</a>
<a class="button btn-blue" id="btn-rev">&lt;&lt;</a>&nbsp;&nbsp;&nbsp;
<a class="button btn-red" id="btn-stop">Stop</a>&nbsp;&nbsp;&nbsp;
<a class="button btn-blue" id="btn-fwd">&gt;&gt;</a>
</div>
<div class="Box center">
<input type="range" id="control-range" value="0" min="-100" max="100" step="0.1">
</div>
<script>

6
html/pages/wifi.tpl

@ -5,7 +5,9 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>WiFi config - WiFi Demo</title>
<title>
Notice: Undefined index: wifi in /home/ondra/devel/f105motor_esp/html_src/_start.php on line 24
- WiFi Demo</title>
<link href="/css/app.css" rel="stylesheet">
<script src="/js/all.js"></script>
@ -19,7 +21,7 @@
<div id="outer">
<nav id="menu">
<div id="brand" onclick="$('#menu').toggleClass('expanded')">WiFi Demo</div>
<a href="/home">Home</a><a href="/wifi" class="selected">WiFi config</a></nav>
<a href="/home">Home</a></nav>
<div id="content">
<img src="/img/loader.gif" alt="Loading…" id="loader">

4
html_src/_start.php

@ -1,11 +1,11 @@
<?php
$prod = defined('STDIN');
$root = $prod ? '' : 'http://192.168.1.15';
$root = $prod ? '' : 'http://192.168.1.18';
$menu = [
'home' => [ $prod ? '/home' : '/page_home.php', 'Home' ],
'wifi' => [ $prod ? '/wifi' : '/page_wifi.php', 'WiFi config' ],
// 'wifi' => [ $prod ? '/wifi' : '/page_wifi.php', 'WiFi config' ],
];
$appname = 'WiFi Demo';

2
html_src/css/app.css

File diff suppressed because one or more lines are too long

BIN
html_src/img/slider.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

59
html_src/js-src/page_home.js

@ -2,23 +2,58 @@
var page_home = (function () {
var home = {};
var last_slider_val = 0;
function applySlider() {
var value = $('#control-range').val();
if (value == last_slider_val) return;
last_slider_val = value;
var dir = 'f';
if (value < 0) {
value *= -1;
dir = 'r';
}
value = (6144 * 3) * (value / 100);
if (value < 20) {
$().get(_root + '/m/stop');
} else {
$().get(_root + '/m/start?dir=' + dir + '&speed=' + Math.round(value));
}
}
function periodicCheckSlider() {
applySlider();
setTimeout(periodicCheckSlider, 150);
}
/** Set up the Home page */
home.init = function () {
$('#btn-fwd').on('mousedown', function() {
console.log('FWD down');
$().get(_root+'/m/start?dir=f');
}).on('mouseup', function() {
console.log('FWD up');
$().get(_root+'/m/stop');
$('#btn-stop').on('mousedown', function () {
$().get(_root + '/m/stop');
$('#control-range').val(0);
});
$('#btn-rev').on('mousedown', function () {
var rng = $('#control-range');
var value = 1*rng.val();
rng.val(value - 10);
applySlider();
});
$('#btn-rev').on('mousedown', function() {
console.log('REV down');
$().get(_root+'/m/start?dir=r');
}).on('mouseup', function() {
console.log('REV up');
$().get(_root+'/m/stop');
$('#btn-fwd').on('mousedown', function () {
var rng = $('#control-range');
var value = 1*rng.val();
rng.val(value + 10);
applySlider();
});
$('#control-range').on('change', applySlider);
periodicCheckSlider();
};
return home;

2
html_src/js/all.js

File diff suppressed because one or more lines are too long

11
html_src/page_home.php

@ -1,11 +1,16 @@
<?php $page = 'home';
include "_start.php"; ?>
<h1>Motor Control</h1>
<h1>Ovládání motoru</h1>
<div class="Box center">
<a class="button btn-blue" id="btn-rev">REV</a><span style="display:inline-block;width:2em"></span>
<a class="button btn-blue" id="btn-fwd">FWD</a>
<a class="button btn-blue" id="btn-rev">&lt;&lt;</a>&nbsp;&nbsp;&nbsp;
<a class="button btn-red" id="btn-stop">Stop</a>&nbsp;&nbsp;&nbsp;
<a class="button btn-blue" id="btn-fwd">&gt;&gt;</a>
</div>
<div class="Box center">
<input type="range" id="control-range" value="0" min="-100" max="100" step="0.1">
</div>
<script>

32
html_src/sass/pages/_home.scss

@ -1,17 +1,25 @@
.page-about {
.Box {
padding-left:dist(0);
padding-right:dist(0);
.page-home {
#control-range {
width: 100%;
a {font-weight: bold;}
}
appearance: none;
height: 50px;
border-radius: 5px;
background-color: #37B0FF;
#logo {
float:right;
height: 130px;
}
background: url(/img/slider.png) center center no-repeat;
background-size: 100% 100%;
&::-webkit-slider-thumb {
appearance: none;
background: #3c90ee;
border: 1px solid #ccc;
height: 44px;
width: 44px;
border-radius: 2px;
#logo2 {
max-width: 150px;
}
}
}

2
user/user_main.c

@ -97,7 +97,7 @@ void user_init(void)
struct softap_config wificfg;
wifi_softap_get_config(&wificfg);
sprintf((char*)wificfg.ssid, "esp_motor_demo");
sprintf((char*)wificfg.ssid, "k338_motor_demo");
wificfg.ssid_len = strlen((char*)wificfg.ssid);
wifi_softap_set_config(&wificfg);

Loading…
Cancel
Save