Skip to content

Commit 0e29004

Browse files
author
David Betz
committed
Add support for automatic character delays after \n.
1 parent d8c785e commit 0e29004

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ INCDIR := $(addprefix -I,$(SRC_DIR))
178178
EXTRA_INCDIR := $(addprefix -I,$(EXTRA_INCDIR))
179179
MODULE_INCDIR := $(addsuffix /include,$(INCDIR))
180180

181-
ESP_FLASH_SIZE_IX=$(call maplookup,$(ESP_SPI_FLASH_SIZE_K),512:0 1024:2 2048:5 4096:4)
182181
ESPTOOL_FREQ=$(call maplookup,$(ESP_FLASH_FREQ_DIV),0:40m 1:26m 2:20m 0xf:80m 15:80m)
183182
ESPTOOL_MODE=$(call maplookup,$(ESP_FLASH_MODE),0:qio 1:qout 2:dio 3:dout)
184183
ESPTOOL_SIZE=$(call maplookup,$(ESP_SPI_FLASH_SIZE_K),512:4m 256:2m 1024:8m 2048:16m 4096:32m)

html/wifi/wifi.html

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,25 @@
7171
xhr.send();
7272
}
7373

74-
window.onload=function(e) {
75-
patchSetting("module-name");
74+
function refreshData() {
75+
patchSetting("station-ipaddr");
76+
patchSetting("station-macaddr");
77+
patchSetting("softap-ipaddr");
78+
patchSetting("softap-macaddr");
79+
};
7680

81+
window.onload = function (e) {
82+
patchSetting("module-name");
7783
wifiModeCtl = document.getElementById("wifi-mode");
7884
var wifiMode = getSetting("wifi-mode");
7985
for (var i = 0; i < wifiModeCtl.length; ++i)
8086
if (wifiMode == wifiModeCtl[i].value) {
8187
wifiModeCtl.selectedIndex = i;
8288
break;
8389
}
84-
85-
patchSetting("station-ipaddr");
86-
patchSetting("station-macaddr");
87-
patchSetting("softap-ipaddr");
88-
patchSetting("softap-macaddr");
90+
refreshData();
8991
updateNetworkList(wifiMode);
90-
};
92+
}
9193

9294
function getSetting(name) {
9395
var req = new XMLHttpRequest();
@@ -129,11 +131,11 @@
129131

130132
function on_wifiModeChanged() {
131133
var newMode = wifiModeCtl[wifiModeCtl.selectedIndex].value;
132-
setSetting("wifi-mode", newMode);
133-
// var req = new XMLHttpRequest();
134-
// var url = '/wifi/setmode.cgi?mode=' + encodeURIComponent(newMode);
135-
// req.open('GET', url, false);
136-
// req.send();
134+
var req = new XMLHttpRequest();
135+
var url = '/wifi/setmode.cgi?mode=' + encodeURIComponent(newMode);
136+
req.open('POST', url, false);
137+
req.send();
138+
refreshData();
137139
updateNetworkList(newMode);
138140
}
139141

parallax/sscp.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,32 @@ static void ICACHE_FLASH_ATTR sendToMCU(int prefix, char *fmt, va_list ap)
229229
buf[2 + cnt] = '\r';
230230
cnt += 3;
231231

232+
// handle inserting pauses after certain characters
232233
if (flashConfig.sscp_pause_time_ms > 0) {
233234
char *p = buf;
234235
while (--cnt >= 0) {
236+
int needPause = 0;
235237
int byte = *p++;
236-
int i;
237238
uart_tx_one_char(UART0, byte);
238-
for (i = 0; i < flashConfig.sscp_need_pause_cnt; ++i) {
239-
if (byte == flashConfig.sscp_need_pause[i]) {
240-
uart_drain_tx_buffer(UART0);
241-
os_delay_us(flashConfig.sscp_pause_time_ms * 1000);
239+
if (byte == '\r')
240+
needPause = 1;
241+
else {
242+
int i;
243+
for (i = 0; i < flashConfig.sscp_need_pause_cnt; ++i) {
244+
if (byte == flashConfig.sscp_need_pause[i]) {
245+
needPause = 1;
246+
break;
247+
}
242248
}
243249
}
250+
if (needPause) {
251+
uart_drain_tx_buffer(UART0);
252+
os_delay_us(flashConfig.sscp_pause_time_ms * 1000);
253+
}
244254
}
245255
}
256+
257+
// no pauses after characters needed
246258
else {
247259
uart_tx_buffer(UART0, buf, cnt);
248260
}

parallax/user_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void ICACHE_FLASH_ATTR user_init(void) {
201201
if (!(restoreOk = configRestore()))
202202
configSave();
203203

204-
captdnsInit();
204+
captdnsInit();
205205

206206
// init UART
207207
uart_init(flashConfig.baud_rate, 115200);

0 commit comments

Comments
 (0)