Change name to ESP3D

Thanks to @openhardwarecoza and @TRoager  for the idea and feedback
This commit is contained in:
luc 2016-06-09 10:23:20 +02:00
parent 700f395cab
commit 713d4764fb
32 changed files with 201 additions and 99 deletions

View File

@ -11,13 +11,13 @@ before_install:
before_script:
- "export DISPLAY=:99.0"
- sleep 3 # give xvfb some time to start
- wget http://downloads.arduino.cc/arduino-1.6.8-linux64.tar.xz
- tar xf arduino-1.6.8-linux64.tar.xz
- mv arduino-1.6.8 $HOME/arduino_ide
- wget http://downloads.arduino.cc/arduino-1.6.9-linux64.tar.xz
- tar xf arduino-1.6.9-linux64.tar.xz
- mv arduino-1.6.9 $HOME/arduino_ide
- cd $HOME/arduino_ide/hardware
- mkdir esp8266com
- cd esp8266com
- git clone https://github.com/esp8266/Arduino.git esp8266
- git clone https://github.com/esp3d/Arduino.git esp8266
- cd esp8266/tools
- python get.py
@ -28,7 +28,7 @@ script:
- export PATH="$HOME/arduino_ide:$PATH"
- arduino --board esp8266com:esp8266:generic --save-prefs
- arduino --get-pref sketchbook.path
- build_sketch esp8266/esp8266.ino
- build_sketch esp3d/esp3d.ino
notifications:
email:

View File

@ -1,44 +1,44 @@
# ESP8266
# ESP3D
Firmware for ESP8266 used with 3D printer using [arduino core version](https://github.com/esp8266/Arduino)
This firmware allows not only to have a cheap bridge between Wifi and serial, but also to have a web UI to configure wifi, to monitor 3D printer and even control it, and to make things easy,
UI is fully customizable without reflashing FW.
Firmware should work with any 3D printer firmware (repetier/marlin/etc..) if serial connection has correct setup.
I currently use it with my personnal flavor of [repetier for Due based boards](https://github.com/luc-github/Repetier-Firmware-0.92).
Please use ESP with at least 1M flash, for ESP with 512K there is limited version [here](https://github.com/luc-github/ESP8266/tree/ESP-512K-64KSPIFFS)
Please use ESP with at least 1M flash, for ESP with 512K there is limited version [here](https://github.com/luc-github/ESP3D/tree/ESP-512K-64KSPIFFS)
<u>Stable version:</u>
Arduino ide 1.6.5 with stable [2.0.0](http://arduino.esp8266.com/versions/2.0.0/package_esp8266com_index.json) from ESP8266, please use https://github.com/luc-github/ESP8266/releases/tag/v0.5.1
Arduino ide 1.6.8 with stable [2.2.0](http://arduino.esp8266.com/versions/2.2.0/package_esp8266com_index.json) from ESP8266, please use https://github.com/luc-github/ESP8266/releases/tag/v0.6.2
Arduino ide 1.6.5 with stable [2.0.0](http://arduino.esp8266.com/versions/2.0.0/package_esp8266com_index.json) from ESP8266, please use https://github.com/luc-github/ESP3D/releases/tag/v0.5.1
Arduino ide 1.6.8 with stable [2.2.0](http://arduino.esp8266.com/versions/2.2.0/package_esp8266com_index.json) from ESP8266, please use https://github.com/luc-github/ESP3D/releases/tag/v0.6.2
<u>Development version:</u>
Arduino ide 1.6.8 with git from ESP8266 : [![Build Status](https://travis-ci.org/luc-github/ESP8266.svg?branch=master)](https://travis-ci.org/luc-github/ESP8266)
Arduino ide 1.6.9 with git from ESP8266 : [![Build Status](https://travis-ci.org/luc-github/ESP3D.svg?branch=master)](https://travis-ci.org/luc-github/ESP3D)
[All releases](https://github.com/luc-github/ESP8266/wiki)
[All releases](https://github.com/luc-github/ESP3D/wiki)
:question:Any question ?[![Join the chat at https://gitter.im/luc-github/ESP8266](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/luc-github/ESP8266?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
:exclamation:Any issue ? check [FAQ](https://github.com/luc-github/ESP8266/issues?utf8=%E2%9C%93&q=label%3AFAQ+) or [submit ticket](https://github.com/luc-github/ESP8266/issues)
:question:Any question ?[![Join the chat at https://gitter.im/luc-github/ESP3D](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/luc-github/ESP3D?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
:exclamation:Any issue ? check [FAQ](https://github.com/luc-github/ESP3D/issues?utf8=%E2%9C%93&q=label%3AFAQ+) or [submit ticket](https://github.com/luc-github/ESP3D/issues)
:+1:Thanks
* to @disneysw for bringing this module idea
* to @lkarlslund for suggestion about independant reset using GPIO2
* to all contributors (treepleks, j0hnlittle, openhardwarecoza, all feedbacks owners and donations)
* to all contributors (treepleks, j0hnlittle, openhardwarecoza, TRoager, all feedbacks owners and donations)
Every support is welcome: [<img src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG_global.gif" border="0" alt="PayPal The safer, easier way to pay online.">](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y8FFE7NA4LJWQ)
Especially if need to buy new modules for testing.
##Features
* Serial/Wifi bridge using configurable port 8888, here to enable/disable [TCP_IP_DATA_FEATURE](https://github.com/luc-github/ESP8266/blob/master/esp8266/config.h)
* Serial/Wifi bridge using configurable port 8888, here to enable/disable [TCP_IP_DATA_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h)
* Use GPIO2 to ground to reset all settings in hard way - 2-6 sec after boot / not before!! Set GPIO2 to ground before boot change boot mode and go to special boot that do not reach FW. Currently boot take 10 sec - giving 8 seconds to connect GPIO2 to GND and do an hard recovery for settings, here to enable/disable [RECOVERY_FEATURE](https://github.com/luc-github/ESP8266/blob/master/esp8266/config.h)
* Wifi configuration by web browser (Station or Access point)
* Authentication for sensitive pages, here to enable/disable [AUTHENTICATION_FEATURE](https://github.com/luc-github/ESP8266/blob/master/esp8266/config.h)
* Update firmware by web browser, here to enable/disable [WEB_UPDATE_FEATURE](https://github.com/luc-github/ESP8266/blob/master/esp8266/config.h)
* Control ESP module using commands on serial or data port, here to enable/disable [SERIAL_COMMAND_FEATURE](https://github.com/luc-github/ESP8266/blob/master/esp8266/config.h)
* UI fully constomizable without reflashing FW using html templates, [keywords](https://raw.githubusercontent.com/luc-github/ESP8266/master/docs/keywords.txt) and html files/images
* Captive portal in Access point mode which redirect all unknow call to main page, here to enable/disable [CAPTIVE_PORTAL_FEATURE](https://github.com/luc-github/ESP8266/blob/master/esp8266/config.h)
* mDNS which allows to key the name defined in web browser and connect only with bonjour installed on computer, here to enable/disable [MDNS_FEATURE](https://github.com/luc-github/ESP8266/blob/master/esp8266/config.h)
* SSDP, this feature is a discovery protocol, supported on Windows out of the box, here to enable/disable [SSDP_FEATURE](https://github.com/luc-github/ESP8266/blob/master/esp8266/config.h)
* Printer monitoring / control (temperatures/speed/jog/list SDCard content/launch,pause or stop a print/etc...), here to enable/disable [MONITORING_FEATURE/INFO_MSG_FEATURE/ERROR_MSG_FEATURE/STATUS_MSG_FEATURE](https://github.com/luc-github/ESP8266/blob/master/esp8266/config.h)
* Authentication for sensitive pages, here to enable/disable [AUTHENTICATION_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h)
* Update firmware by web browser, here to enable/disable [WEB_UPDATE_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h)
* Control ESP module using commands on serial or data port, here to enable/disable [SERIAL_COMMAND_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h)
* UI fully constomizable without reflashing FW using html templates, [keywords](https://raw.githubusercontent.com/luc-github/ESP3D/master/docs/keywords.txt) and html files/images
* Captive portal in Access point mode which redirect all unknow call to main page, here to enable/disable [CAPTIVE_PORTAL_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h)
* mDNS which allows to key the name defined in web browser and connect only with bonjour installed on computer, here to enable/disable [MDNS_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h)
* SSDP, this feature is a discovery protocol, supported on Windows out of the box, here to enable/disable [SSDP_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h)
* Printer monitoring / control (temperatures/speed/jog/list SDCard content/launch,pause or stop a print/etc...), here to enable/disable [MONITORING_FEATURE/INFO_MSG_FEATURE/ERROR_MSG_FEATURE/STATUS_MSG_FEATURE](https://github.com/luc-github/ESP3D/blob/master/esp3d/config.h)
* Fail safe mode (Access point)is enabled if cannot connect to defined station at boot.
##Web configuration
@ -71,25 +71,25 @@ Password: admin
These are the pages defined using template:
Home page :
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/UI/Page1.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/UI/Page1.png><br>
System Configuration Page:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/UI/Page2.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/UI/Page2.png><br>
Access Point Configuration Page:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/UI/Page3.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/UI/Page3.png><br>
Client Configuration Page:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/UI/Page4.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/UI/Page4.png><br>
Printer Status Page for 64K SPIFFS, due to limited space available no fancy:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/UI/Page5-2.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/UI/Page5-2.png><br>
Printer Status Page for more than 64K SPIFFS, fancy one:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/UI/page5.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/UI/page5.png><br>
Extra Settings Page, for web UI and for printer:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/UI/Page6.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/UI/Page6.png><br>
Change password Page:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/UI/Page7.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/UI/Page7.png><br>
Login Page:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/UI/Page8.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/UI/Page8.png><br>
the template files are stored on SPIFFS:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/UI/files.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/UI/files.png><br>
and uploaded using [pluggin IDE](http://esp8266.github.io/Arduino/versions/2.1.0/doc/filesystem.html#uploading-files-to-file-system)
Any files on SPIFFS can be called on web interface without having the path hard coded, this give more flexibility, favicon.ico is a good example of it.
So UI is kind of separated from FW which allow easier modifications. For this a light file manager is available in extra settings page, it allows to upload/download/delete files.
@ -114,10 +114,10 @@ Additionally 404.tpl (the page not found) and restart.tpl(restart page when appl
##Installation
* For stable:
Please use [Arduino IDE 1.6.5](http://arduino.cc/en/Main/Software) with the esp8266 module from board manager use 2.0.0 stable version by adding in your preferences http://arduino.esp8266.com/version/2.0.0/package_esp8266com_index.json
with https://github.com/luc-github/ESP8266/releases/tag/v0.5.1
with https://github.com/luc-github/ESP3D/releases/tag/v0.5.1
or
use [Arduino IDE 1.6.8](http://arduino.cc/en/Main/Software) with the esp8266 module from board manager use 2.2.0 stable version by adding in your preferences http://arduino.esp8266.com/stable/package_esp8266com_index.json
with https://github.com/luc-github/ESP8266/releases/tag/v0.6.2
with https://github.com/luc-github/ESP3D/releases/tag/v0.6.2
* For development:
Please use [Arduino IDE 1.6.8](http://arduino.cc/en/Main/Software) and [git version of esp8266 module](http://esp8266.github.io/Arduino/versions/2.2.0/doc/installing.html#using-git-version)
@ -136,16 +136,16 @@ Once flashed you also can use the web updater to flash new FW in System Configur
* Use GPIO0 to ground to be in update mode
For ESP01:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/HW/Wires.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/HW/Wires.png><br>
For ESP12E:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/HW/WiresESP12E.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/HW/WiresESP12E.png><br>
For Davinci Board:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/Davinci/davinci.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/Davinci/davinci.png><br>
For RADDS Board:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/RADDS/RADDS.png><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/RADDS/RADDS.png><br>
##Contribution/customization
To modifying and Testing tpl files a local tool has been created by [j0hnlittle](https://github.com/j0hnlittle) to avoid to upload everytime your tpl files just to see the results of your modifications. It is a python script (2.7+) located in tools directory, launch it: python server.py, then open browser: http://localhost:8080
@ -158,17 +158,17 @@ Feedback/suggestion/discussions are always welcome
##Result of ESP12E on Davinci
I use a proto board to connect ESP12E socket, one micro switch for recovery, one jumper for normal usage/ flash, I did not put hardware switch.
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/Davinci/board.jpg><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/Davinci/board.jpg><br>
Connected to Davinci:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/Davinci/boardconnected.jpg><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/Davinci/boardconnected.jpg><br>
The back cover:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/Davinci/backside.jpg><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/Davinci/backside.jpg><br>
The screen when connected to AP:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/Davinci/screen.jpg><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/Davinci/screen.jpg><br>
##Result of ESP12E on Due/RADDS
the rendering on screen when connection to AP is done:
<img src=https://raw.githubusercontent.com/luc-github/ESP8266/master/images/RADDS/screen.jpg><br>
<img src=https://raw.githubusercontent.com/luc-github/ESP3D/master/images/RADDS/screen.jpg><br>
##TODO

View File

@ -37,7 +37,8 @@ void COMMAND::execute_command(int cmd,String cmd_params)
switch(cmd) {
byte mode;
case 800:
Serial.println("\nCommand received");
Serial.print("\nFW version:");
Serial.println(FW_VERSION);
break;
case 100:
if(!CONFIG::write_string(EP_SSID,cmd_params.c_str())) {
@ -133,13 +134,21 @@ void COMMAND::check_command(String buffer)
static bool bfileslist=false;
String buffer2;
static uint32_t start_list=0;
//if SD list is not on going
if (!bfileslist) {
//check if command is a start of SD File list
int filesstart = buffer.indexOf("Begin file list");
//yes it is file list starting to be displayed
if (filesstart>-1) {
Serial.print("Starting");
//init time out
start_list=system_get_time();
//set file list started
bfileslist=true;
//clear current list
web_interface->fileslist.clear();
//block any new output to serial from ESP to avoid pollution
(web_interface->blockserial) = true;
return;
}
int Tpos = buffer.indexOf("T:");
int Xpos = buffer.indexOf("X:");
@ -237,16 +246,19 @@ void COMMAND::check_command(String buffer)
(web_interface->status_msg).add(buffer.substring(Statuspos+7).c_str());
#endif
}
} else {
} else { //listing file is on going
//check if we are too long
if ((system_get_time()-start_list)>30000000) { //timeout in case of problem
bfileslist=false;
Serial.print("time out");
(web_interface->blockserial) = false; //release serial
} else {
//check if this is the end
if (buffer.indexOf("End file list")>-1) {
Serial.print("Ending");
bfileslist=false;
(web_interface->blockserial) = false;
} else {
Serial.print(buffer);
//Serial.print(buffer);
//add list to buffer
web_interface->fileslist.add(buffer);
}
}

View File

@ -60,7 +60,7 @@
#include <Arduino.h>
#include "wifi.h"
//version and sources location
#define FW_VERSION "0.6.2"
#define FW_VERSION "0.7.5"
#define REPOSITORY "https://github.com/luc-github/ESP8266"

View File

@ -48,3 +48,5 @@ caption{padding-top:8px;padding-bottom:8px;color:#777777;text-align:left;}
.btnimg:hover{background-color:#F0F0F0;border-color:#00FFFF;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;}
.btnroundimg {cursor:hand; border-radius:30px;}
.btnroundimg:hover{background-color:#F0F0F0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #ce8483;}
.blacklink {color:#000000;}
.blacklink:hover, .filelink:focus {color:#0094FF;}

14
esp3d/data/css2.inc Normal file
View File

@ -0,0 +1,14 @@
<STYLE>
input[type="file"]::-webkit-file-upload-button{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer;
background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;
* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #5bc0de;border-color: #46b8da;}
input[type="file"]::-webkit-file-upload-button:focus{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer;
background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;
* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #31b0d5;border-color: #1b6d85;}
input[type="file"]::-webkit-file-upload-button:hover{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer;
background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;
* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #31b0d5;border-color: #269abc;}
.filelink {color:#000000;}
.filelink:hover, .filelink:focus {color:#0094FF;}
.panel-footer{padding:10px 15px;color:#31708f;background-color:#f5f5f5;border-color:#dddddd;border-top:1px solid #dddddd;}
</STYLE>

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

6
esp3d/data/footer.inc Normal file
View File

@ -0,0 +1,6 @@
$SERVICE_PAGE$
<hr><br>
<div class="panel">
<center><table><tr><td><a class='blacklink' href='https://github.com/luc-github/ESP3D'>ESP3D powered</a></td><td>-</td><td><a class='blacklink' href='http://www.gnu.org/licenses/gpl-2.0.html'>GPL licensed</a></td></center></div>
</body>
</html>

View File

@ -25,6 +25,6 @@ $INCLUDE[css.inc]$
<circle style="fill:white" cx="20" cy="22" r="2.5"/>
<polygon points="20,23 16,30 24,30" style="fill:white"/></svg></div></a></td>
<td>FW: V$FW_VER$</td>
<td><a href="https://github.com/luc-github/ESP8266">Github</a></td>
<td><a href="https://github.com/luc-github/ESP3D">ESP3D</a></td>
</tr>
</table>

View File

@ -1,4 +1,5 @@
$INCLUDE[header.inc]$
$INCLUDE[css2.inc]$
<table>
<tr><td style="padding:0px;"><div id="Extruder1" style="visibility:hidden;height:0px;">
<table><tr><td><label>E1:&nbsp;</label></td>
@ -67,7 +68,10 @@ $INCLUDE[header.inc]$
<td class="btnimg" onclick="getSDfiles();"><svg width="40" height="40" viewBox="0 0 40 40"><rect x="5" y="10" width="30" height="20" rx="2" ry="2" style="fill:rgb(0,0,0);stroke-width:1;stroke:rgb(0,0,0)" />
<rect x="20" y="5" width="15" height="15" rx="2" ry="2" style="fill:rgb(0,0,0);stroke-width:1;stroke:rgb(0,0,0)" /><text x="10" y="25" font-family="Verdana" font-size="14" fill="white">SD</text></svg></td>
<td>&nbsp;&nbsp;</td>
<td id="SDLIST"></td></tr></table></td></tr><tr><td><table><tr align="center" valign="middle"><td class="btnimg" onclick=" Sendcommand('G28 X');">
<td id="SDLIST"></td></tr></table></td></tr>
<tr><td><input type="file" id="file-select" name="myfiles[]" multiple />
<input class="btn btn-primary" type="button" id="upload-button" onclick="Sendfile();" value="Upload"/>&nbsp;&nbsp;<progress style="visibility:hidden;" name='prg' id='prg'></progress></td></tr>
<tr><td><table><tr align="center" valign="middle"><td class="btnimg" onclick=" Sendcommand('G28 X');">
<svg width="40" height="40" viewBox="0 0 40 40" ><polygon points="7,40 7,25 4,28 0,24 20,4 26,10 26,6 32,6 32,16 40,24 36,28 33,25 33,40" fill="black" stroke-width:"1" stroke:"black" />
<line x1="25" y1="8" x2="33" y2="16" style="stroke:white;stroke-width:1" /><polyline points="4,28 20,12 36,28" style="fill:none;stroke:white;stroke-width:1" />
<text x="15" y="35" font-family="Verdana" font-size="14" fill="white">X</text></svg></td><td>
@ -141,6 +145,7 @@ $INCLUDE[header.inc]$
<text x="14" y="7" font-family="Verdana" font-size="7" fill="black">10</text></svg></td></tr>
<tr><td class="btnimg" onclick="SendJogcommand( 'E1+50',Efeedrate);"><svg width="40" height="20" viewBox="0 0 40 20" ><polyline points="5,18 20,5 35,18" style="fill:none;stroke:pink;stroke-width:7" transform="rotate(180 20 10)"/>
<text x="15" y="6" font-family="Verdana" font-size="7" fill="black">50</text></svg></td></tr></table></td></tr></table></td></tr></table>
<script type="text/javascript">
var XYfeedrate=$XY_FEEDRATE$;
var Zfeedrate=$Z_FEEDRATE$;
@ -380,7 +385,7 @@ document.getElementById("SDLIST").innerHTML="";
Sendcommand("M20");
delay(1000);
var xmlhttp = new XMLHttpRequest();
var url = "http://$WEB_ADDRESS$/SDFILES";
var url = "/SDFILES";
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var jsonresponse = JSON.parse(xmlhttp.responseText);
@ -389,6 +394,30 @@ refreshfilelist(jsonresponse);}
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
function Sendfile(){
var files = document.getElementById('file-select').files;
if (files.length==0)return;
document.getElementById('upload-button').value = "Uploading...";
document.getElementById('prg').style.visibility = "visible";
var formData = new FormData();
for (var i = 0; i < files.length; i++) {
var file = files[i];
formData.append('myfiles[]', file, "/"+file.name);}
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', '/SDFILES', true);
xmlhttp.onload = function () {
if (xmlhttp.status === 200) {
document.getElementById('upload-button').value = 'Upload';
document.getElementById('prg').style.visibility = "hidden";
document.getElementById('file-select').value="";
var jsonresponse = JSON.parse(xmlhttp.responseText);
refreshfilelist(jsonresponse);
} else alert('An error occurred!');
}
xmlhttp.send(formData);
}
setInterval(function(){getstatus();},$REFRESH_PAGE$);
</script>
$INCLUDE[footer.inc]$

View File

@ -1,16 +1,6 @@
$INCLUDE[header.inc]$
$INCLUDE[css2.inc]$
<STYLE>
input[type="file"]::-webkit-file-upload-button{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer;
background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;
* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #5bc0de;border-color: #46b8da;}
input[type="file"]::-webkit-file-upload-button:focus{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer;
background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;
* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #31b0d5;border-color: #1b6d85;}
input[type="file"]::-webkit-file-upload-button:hover{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer;
background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;
* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #31b0d5;border-color: #269abc;}
.filelink {color:#000000;}
.filelink:hover, .filelink:focus {color:#0094FF;}
.panel-footer{padding:10px 15px;color:#31708f;background-color:#f5f5f5;border-color:#dddddd;border-top:1px solid #dddddd;}
</STYLE>
<div class="panel">
@ -61,7 +51,7 @@ content +="<meter min='0' max='100' high='90' value='"+jsonresponse.occupation +
document.getElementById('status').innerHTML=content;
content ="";
for (var i=0;i <jsonresponse.files.length;i++){
content +="<TR><TD style=\"padding:0px;\"><a href=\""+jsonresponse.files[i].name+"\" target=_blank><div class=\"filelink\">";
content +="<TR><TD style=\"padding:0px;\"><a href=\""+jsonresponse.files[i].name+"\" target=_blank><div class=\"blacklink\">";
content +=jsonresponse.files[i].name;
content +="</div></a></TD><TD>";
content +=jsonresponse.files[i].size;

View File

@ -1,15 +1,5 @@
$INCLUDE[header.inc]$
<STYLE>
input[type="file"]::-webkit-file-upload-button{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer;
background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;
* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #5bc0de;border-color: #46b8da;}
input[type="file"]::-webkit-file-upload-button:focus{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer;
background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;
* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #31b0d5;border-color: #1b6d85;}
input[type="file"]::-webkit-file-upload-button:hover{display:inline-block;margin-bottom:0;font-weight:normal;text-align:center;vertical-align:middle;-ms-touch-action:manipulation; touch-action:manipulation;cursor:pointer;
background-image:none;border:1px solid transparent;white-space:nowrap;padding:6px 12px;font-size:14px;line-height:1.42857143;border-radius:4px;
* -webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none; color: #ffffff;background-color: #31b0d5;border-color: #269abc;}
</STYLE>
$INCLUDE[css2.inc]$
<div id='system' class="panel">
<div class="panel-heading">System</div>
<div class="panel-body">

View File

@ -195,18 +195,21 @@ void loop()
serverClient.stop();
}
//check clients for data
for(i = 0; i < MAX_SRV_CLIENTS; i++) {
if (serverClients[i] && serverClients[i].connected()) {
if(serverClients[i].available()) {
//get data from the tcp client and push it to the UART
while(serverClients[i].available()) {
data = serverClients[i].read();
Serial.write(data);
COMMAND::read_buffer_tcp(data);
}
}
}
}
//to avoid any pollution if Uploading file to SDCard
if ((web_interface->blockserial) == false){
for(i = 0; i < MAX_SRV_CLIENTS; i++) {
if (serverClients[i] && serverClients[i].connected()) {
if(serverClients[i].available()) {
//get data from the tcp client and push it to the UART
while(serverClients[i].available()) {
data = serverClients[i].read();
Serial.write(data);
COMMAND::read_buffer_tcp(data);
}
}
}
}
}
#endif
//check UART for data
if(Serial.available()) {

View File

@ -2094,7 +2094,7 @@ void handle_web_settings()
web_interface->WebServer.sendContent_P(NOT_AUTH_SET);
return;
}
web_interface->blockserial = false;
//IP+Web
GetIpWeb(KeysList, ValuesList);
//mode
@ -2409,19 +2409,63 @@ void SPIFFSFileupload()
HTTPUpload& upload = (web_interface->WebServer).upload();
if(upload.status == UPLOAD_FILE_START) {
String filename = upload.filename;
Serial.println("M117 Start ESP upload");
web_interface->fsUploadFile = SPIFFS.open(filename, "w");
filename = String();
web_interface->_upload_status= UPLOAD_STATUS_ONGOING;
} else if(upload.status == UPLOAD_FILE_WRITE) {
web_interface->_upload_status= UPLOAD_STATUS_ONGOING;
if(web_interface->fsUploadFile) {
web_interface->fsUploadFile.write(upload.buf, upload.currentSize);
}
} else if(upload.status == UPLOAD_FILE_END) {
web_interface->_upload_status=UPLOAD_STATUS_SUCCESSFUL;
Serial.println("M117 End ESP upload");
if(web_interface->fsUploadFile) {
web_interface->fsUploadFile.close();
}
} else {
Serial.println("Cannot open file");
web_interface->_upload_status=UPLOAD_STATUS_CANCELLED;
Serial.println("M117 Error ESP upload");
}
delay(0);
}
void SDFileupload()
{
static bool linewrote = false;
HTTPUpload& upload = (web_interface->WebServer).upload();
if(upload.status == UPLOAD_FILE_START) {
(web_interface->blockserial) = true;
linewrote = false;
web_interface->_upload_status= UPLOAD_STATUS_ONGOING;
Serial.println("M117 Start SD upload");
String filename = "M28 " + upload.filename;
Serial.println(filename);
filename = String();
} else if(upload.status == UPLOAD_FILE_WRITE) {
web_interface->_upload_status= UPLOAD_STATUS_ONGOING;
if (linewrote == false){
Serial.write("M117 one line yes\n");
Serial.flush();
linewrote = true;
}
//Serial.write(upload.buf, upload.currentSize);
} else if(upload.status == UPLOAD_FILE_END) {
web_interface->blockserial = false;
linewrote = false;
web_interface->_upload_status=UPLOAD_STATUS_SUCCESSFUL;
Serial.println("M29\n");
delay (500);
Serial.println("M117 SD upload done\n");
} else {
web_interface->_upload_status=UPLOAD_STATUS_CANCELLED;
Serial.println("M29\n");
delay (500);
Serial.println("M117 SD upload failed");
}
delay(0);
}
#ifdef WEB_UPDATE_FEATURE
@ -2448,7 +2492,7 @@ void WebUpdateUpload()
Update.end();
web_interface->_upload_status=UPLOAD_STATUS_CANCELLED;
}
yield();
delay(0);
}
void handleUpdate()
@ -2525,6 +2569,15 @@ void handleSDFileList()
{
if (!web_interface->is_authenticated()) {
return;
}
if(web_interface->WebServer.hasArg("action")) {
if(web_interface->WebServer.arg("action")=="delete" && web_interface->WebServer.hasArg("filename")) {
String filename;
web_interface->urldecode(filename,web_interface->WebServer.arg("filename").c_str());
filename = "M30 " + filename;
//TODO:need a MACRO or helper for this test
if((web_interface->blockserial) == false)Serial.println(filename);
}
}
String jsonfile = "[";
for (int i=0; i<web_interface->fileslist.size(); i++) {
@ -2538,6 +2591,7 @@ void handleSDFileList()
jsonfile+="]";
web_interface->WebServer.sendHeader("Cache-Control", "no-cache");
web_interface->WebServer.send(200, "application/json", jsonfile);
web_interface->blockserial = false;
}
//do a redirect to avoid to many query
@ -2767,8 +2821,6 @@ void handle_web_command()
//decode command
web_interface->urldecode(scmd,web_interface->WebServer.arg("COM").c_str());
scmd.trim();
//send command to serial
Serial.println(scmd);
//give an ack - we need to be polite, right ?
web_interface->WebServer.send(200,"text/plain","Ok");
//if it is for ESP module [ESPXXX]<parameter>
@ -2791,6 +2843,11 @@ void handle_web_command()
//if not is not a valid [ESPXXX] command
}
}
else {
//send command to serial as no need to transfer ESP command
//to avoid any pollution if Uploading file to SDCard
if ((web_interface->blockserial) == false)Serial.println(scmd);
}
}
}
@ -2856,7 +2913,7 @@ WEBINTERFACE_CLASS::WEBINTERFACE_CLASS (int port):WebServer(port)
WebServer.on("/UPDATE",HTTP_ANY, handleUpdate,WebUpdateUpload);
#endif
WebServer.on("/FILES", HTTP_ANY, handleFileList,SPIFFSFileupload);
WebServer.on("/SDFILES", HTTP_ANY, handleSDFileList);
WebServer.on("/SDFILES", HTTP_ANY, handleSDFileList,SDFileupload);
WebServer.on("/LOGIN", HTTP_ANY, handle_login);
WebServer.on("/PASSWORD", HTTP_ANY, handle_password);
//Captive portal Feature
@ -2872,6 +2929,7 @@ WEBINTERFACE_CLASS::WEBINTERFACE_CLASS (int port):WebServer(port)
answer4M114="X:0.0 Y:0.0 Z:0.000";
answer4M220="100";
answer4M221="100";
blockserial = false;
last_temp=system_get_time();
restartmodule=false;
//rolling list of 4entries with a maximum of 50 char for each entry

View File

@ -62,6 +62,7 @@ public:
char * create_session_ID();
bool is_authenticated();
bool AddAuthIP(auth_ip * item);
bool blockserial;
bool ResetAuthIP(IPAddress ip,const char * sessionID);
uint8_t _upload_status;

View File

@ -1,3 +0,0 @@
$SERVICE_PAGE$
</body>
</html>

View File

@ -8,7 +8,7 @@ import json
import re
#Replace this with a different path if you need to...
base_path = os.path.join(os.getcwd(),"..","esp8266","data")
base_path = os.path.join(os.getcwd(),"..","esp3d","data")
tools_path = os.getcwd();
server_port=8080