Skip to content

Commit 77a61c3

Browse files
committed
Initial commit
0 parents  commit 77a61c3

30 files changed

+1116
-0
lines changed

FreeRTOSConfig.h

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* FreeRTOSConfig overrides.
2+
3+
This is intended as an example of overriding some of the default FreeRTOSConfig settings,
4+
which are otherwise found in FreeRTOS/Source/include/FreeRTOSConfig.h
5+
*/
6+
7+
#define configUSE_RECURSIVE_MUTEXES 1
8+
9+
/* Use the defaults for everything else */
10+
#include_next<FreeRTOSConfig.h>
11+

Makefile

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
CC = xtensa-lx106-elf-gcc
2+
3+
TOOLCHAIN ?= ../esp-open-sdk
4+
ESP_RTOS_BASE ?= ../esp-open-rtos
5+
6+
SDK_BASE = $(TOOLCHAIN)/sdk
7+
# ESP_SDK = $(shell $(CC) -print-sysroot)/usr
8+
9+
#SPI flash size, in KB
10+
ESP_FLASH_SIZE ?= 4096
11+
#0: QIO, 1: QOUT, 2: DIO, 3: DOUT
12+
ESP_FLASH_MODE ?= 0
13+
#0: 40MHz, 1: 26MHz, 2: 20MHz, 15: 80MHz
14+
ESP_FLASH_FREQ_DIV ?= 15
15+
ESP_SPEED ?= 921600
16+
ESP_PORT ?= /dev/ttyUSB0
17+
ESP_IP ?= 192.168.4.1
18+
19+
#Tag for OTA images. 0-27 characters. Change to eg your projects title.
20+
LIBESPHTTPD_OTA_TAGNAME ?= esp_ws2812
21+
22+
LIBESPHTTPD_MAX_CONNECTIONS ?= 8
23+
LIBESPHTTPD_STACKSIZE ?= 2048
24+
25+
CURL ?= curl
26+
CURL_OPTS = --connect-timeout 3 --max-time 60 -s
27+
28+
ESPBAUD = $(ESP_SPEED)
29+
30+
maplookup = $(patsubst $(strip $(1)):%,%,$(filter $(strip $(1)):%,$(2)))
31+
32+
# CONFIG_POS = "$$(printf "0x%X" $$(($(ESP_FLASH_SIZE)*512-0x2000)))"
33+
#CONFIG_POS = 0x1FE000
34+
CONFIG_POS = $(call maplookup,$(ESP_FLASH_SIZE),4096:0xFE000)
35+
36+
#############################################################
37+
PROGRAM=esp_ws2812
38+
39+
PROGRAM_SRC_DIR=src src/web
40+
PROGRAM_INC_DIR=src/include src/include/web
41+
42+
PROGRAM_CFLAGS += -DFREERTOS -DLIBESPHTTPD_OTA_TAGNAME="\"$(LIBESPHTTPD_OTA_TAGNAME)\"" -DFLASH_SIZE=$(FLASH_SIZE)
43+
PROGRAM_CFLAGS += -std=gnu99
44+
45+
#EXTRA_CFLAGS += -DCONFIG_POS=$(CONFIG_POS) -DFREERTOS -mlongcalls #
46+
EXTRA_CFLAGS += -DMEMP_NUM_NETCONN=$(LIBESPHTTPD_MAX_CONNECTIONS)
47+
48+
EXTRA_COMPONENTS = extras/rboot-ota extras/dhcpserver extras/libesphttpd
49+
EXTRA_COMPONENTS += extras/i2s_dma extras/ws2812_i2s
50+
51+
include $(ESP_RTOS_BASE)/common.mk
52+

html/cats/cross-eyed-cat.jpg

35.6 KB
Loading

html/cats/junge-katze-iv.jpg

33.5 KB
Loading

html/cats/kitten-loves-toy.jpg

48.3 KB
Loading

html/flash/140medley.min.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

html/flash/index.html

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<html>
2+
<head><title>Upgrade firmware</title>
3+
<link rel="stylesheet" type="text/css" href="style.css">
4+
<script type="text/javascript" src="140medley.min.js"></script>
5+
<script type="text/javascript">
6+
7+
var xhr=j();
8+
9+
function doReboot() {
10+
xhr.open("GET", "reboot");
11+
xhr.onreadystatechange=function() {
12+
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) {
13+
window.setTimeout(function() {
14+
location.reload(true);
15+
}, 3000);
16+
}
17+
}
18+
//ToDo: set timer to
19+
xhr.send();
20+
}
21+
22+
function setProgress(amt) {
23+
$("#progressbarinner").style.width=String(amt*200)+"px";
24+
}
25+
26+
function doUpgrade() {
27+
var f=$("#file").files[0];
28+
if (typeof f=='undefined') {
29+
$("#remark").innerHTML="Can't read file!";
30+
return
31+
}
32+
xhr.open("POST", "upload");
33+
xhr.onreadystatechange=function() {
34+
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) {
35+
setProgress(1);
36+
if (xhr.responseText!="") {
37+
$("#remark").innerHTML="Error: "+xhr.responseText;
38+
} else {
39+
$("#remark").innerHTML="Uploading done. Rebooting.";
40+
doReboot();
41+
}
42+
}
43+
}
44+
if (typeof xhr.upload.onprogress != 'undefined') {
45+
xhr.upload.onprogress=function(e) {
46+
setProgress(e.loaded / e.total);
47+
}
48+
}
49+
xhr.send(f);
50+
return false;
51+
}
52+
53+
54+
window.onload=function(e) {
55+
xhr.open("GET", "next");
56+
xhr.onreadystatechange=function() {
57+
if (xhr.readyState==4 && xhr.status>=200 && xhr.status<300) {
58+
var txt="Please upload "+xhr.responseText+" or ota file.";
59+
$("#remark").innerHTML=txt;
60+
setProgress(0);
61+
}
62+
}
63+
xhr.send();
64+
}
65+
66+
</script>
67+
</head>
68+
<body>
69+
<div id="main">
70+
<h1>Update firmware</h1>
71+
<div id="remark">Loading...</div>
72+
<input type="file" id="file" />
73+
<input type="submit" value="Upgrade!" onclick="doUpgrade()" />
74+
<div id="progressbar"><div id="progressbarinner"></div></div>
75+
</body>

html/flash/style.css

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
body {
3+
background-color: #404040;
4+
font-family: sans-serif;
5+
}
6+
7+
#main {
8+
background-color: #d0d0FF;
9+
-moz-border-radius: 5px;
10+
-webkit-border-radius: 5px;
11+
border-radius: 5px;
12+
border: 2px solid #000000;
13+
width: 800px;
14+
margin: 0 auto;
15+
padding: 20px
16+
}
17+
18+
#progressbar {
19+
margin: 10px;
20+
padding: 0;
21+
border: 1px solid #000000;
22+
height: 20px;
23+
width: 200px;
24+
background-color: #808080;
25+
}
26+
27+
#progressbarinner {
28+
width: 10px;
29+
height: 20px;
30+
border: none;
31+
background-color: #00ff00;
32+
}
33+
34+

html/index.tpl

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<html>
2+
<head><title>Esp8266 web server</title>
3+
<link rel="stylesheet" type="text/css" href="style.css">
4+
</head>
5+
<body>
6+
<div id="main">
7+
<h1>It Works</h1>
8+
<p>
9+
If you see this, it means the tiny li'l website in your ESP8266 does actually work. Fyi, this page has
10+
been loaded <b>%counter%</b> times.
11+
<ul>
12+
<li>If you haven't connected this device to your WLAN network now, you can <a href="/wifi">do so.</a></li>
13+
<li>You can also control the <a href="led.tpl">LED</a>.</li>
14+
<li>Esphttpd now also supports <a href="websocket/index.html">websockets</a>.</li>
15+
<li>Test esphttpd using the built-in <a href="test/">test suite</a></li>
16+
<li>And because I can, here's a link to my <a href="http://spritesmods.com/?f=esphttpd">website</a></ul>
17+
</ul>
18+
</p>
19+
20+
<p>And because we're on the Internets now, here are the required pictures of cats:<br />
21+
<img src="cats/cross-eyed-cat.jpg"><br />
22+
<img src="cats/junge-katze-iv.jpg"><br />
23+
<img src="cats/kitten-loves-toy.jpg"><br />
24+
</p>
25+
</div>
26+
</body></html>

html/led.tpl

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<html><head><title>Test</title>
2+
<link rel="stylesheet" type="text/css" href="style.css">
3+
</head>
4+
<body>
5+
<div id="main">
6+
<h1>The LED</h1>
7+
<p>
8+
If there's a LED connected to GPIO2, it's now %ledstate%. You can change that using the buttons below.
9+
</p>
10+
<form method="post" action="led.cgi">
11+
<input type="submit" name="led" value="1">
12+
<input type="submit" name="led" value="0">
13+
</form>
14+
</div>
15+
</body></html>

html/style.css

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
body {
3+
background-color: #404040;
4+
font-family: sans-serif;
5+
}
6+
7+
#main {
8+
background-color: #d0d0FF;
9+
-moz-border-radius: 5px;
10+
-webkit-border-radius: 5px;
11+
border-radius: 5px;
12+
border: 2px solid #000000;
13+
width: 800px;
14+
margin: 0 auto;
15+
padding: 20px
16+
}
17+

html/test/index.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<html><head><title>Webserver test</title></head>
2+
<link rel="stylesheet" type="text/css" href="../wifi/style.css">
3+
<script type="text/javascript" src="../wifi/140medley.min.js"></script>
4+
<script type="text/javascript" src="test.js"></script>
5+
<body>
6+
<div id="main">
7+
<div id="log">Initializing test...</div>
8+
</div>
9+
</body>

0 commit comments

Comments
 (0)