Statistics: Posted by hdrut — Wed Mar 02, 2016 9:38 pm
Statistics: Posted by ESP_Faye — Wed Mar 02, 2016 8:33 pm
Statistics: Posted by hdrut — Wed Feb 17, 2016 8:09 pm
Statistics: Posted by ESP_Faye — Thu Feb 04, 2016 10:22 am
Code:
HTTPS server started.
server handshake start.
Fatal exception 28(LoadProhibitedCause):
epc1=0x4026bfa5, epc2=0x00000000, epc3=0x00000000, excvaddr=0x0000000c, depc=0x00▒▒▒Sb9▒a▒▒▒ʿ▒▒▒H▒s▒▒B[▒▒▒: softAP(5e:cf:7f:02:33:57)
Statistics: Posted by crosofg — Tue Feb 02, 2016 12:18 am
Code:
#include"ets_sys.h"
#include"osapi.h"
#include"gpio.h"
#include"os_type.h"
#include"user_interface.h"
#include"mem.h"
#include"espconn.h"
#include"driver/uart.h"
// Make your own user_config.h
#include"user_config.h" // defines WIFI_SSID and WIFI_PSWD
// These files are created by makecert.sh
#include "ssl/cert.h" // defines myesp_crt_DER and myesp_crt_DER_len
#include "ssl/private_key.h" // defines myesp_key_DER and myesp_key_DER_len
// listener connection data
struct espconn listenConn;
esp_tcp listenConnTcp;
// standard HTTP reply
uint8_t* reply = "HTTP/1.1 200 OK\r\n"
"Connection: close\r\n" // make the client (browser) close the connection after receipt
"Content-type: text/html\r\n"
"Content-length: 30\r\n\r\n"
"<html><body>Test</body></html>\0";
void ICACHE_FLASH_ATTR
onRecv(void* arg, char* data, unsigned short length) {
os_printf("Received %d bytes from client:\n--begin data--\n", length);
uart0_tx_buffer(data, length);
os_printf("\n--end data--\n");
// send reply
struct espconn* clientConn = (struct espconn*) arg;
espconn_secure_send(clientConn, reply, os_strlen(reply));
}
void ICACHE_FLASH_ATTR
onSent(void* arg) {
os_printf("Sent data to client.\n");
}
void ICACHE_FLASH_ATTR
onError(void* arg, int8_t err) {
os_printf("Connection error: %d\n", err);
}
void ICACHE_FLASH_ATTR
onDisconn(void* arg) {
os_printf("Client disconnected.\n");
}
void ICACHE_FLASH_ATTR
onClientConnected(void* arg) {
struct espconn* clientConn = (struct espconn*) arg;
os_printf("Client connected from %d.%d.%d.%d:%d.\n",
clientConn->proto.tcp->remote_ip[0],
clientConn->proto.tcp->remote_ip[1],
clientConn->proto.tcp->remote_ip[2],
clientConn->proto.tcp->remote_ip[3],
clientConn->proto.tcp->remote_port);
// register callback functions
espconn_regist_recvcb(clientConn, onRecv);
espconn_regist_sentcb(clientConn, onSent);
espconn_regist_reconcb(clientConn, onError);
espconn_regist_disconcb(clientConn, onDisconn);
}
void ICACHE_FLASH_ATTR
onWifiEvent(System_Event_t *event) {
if (event->event != EVENT_SOFTAPMODE_STACONNECTED)
return;
os_printf("WiFi is up, starting HTTPS server...\n");
// set listener configuration and register callback
listenConn.type = ESPCONN_TCP;
listenConn.state = ESPCONN_NONE;
listenConn.proto.tcp = &listenConnTcp;
listenConnTcp.local_port = 443;
espconn_regist_connectcb(&listenConn, onClientConnected);
// SSL configuration
espconn_secure_set_size(0x02, 8192);
espconn_secure_ca_disable(0x02);
// set server certificate (defined in user_config.h and cert.h)
espconn_secure_set_default_certificate(myesp_crt_DER, myesp_crt_DER_len);
espconn_secure_set_default_private_key(myesp_key_DER, myesp_key_DER_len);
// start listening
espconn_secure_accept(&listenConn);
os_printf("HTTPS server started.\n");
}
void ICACHE_FLASH_ATTR
onInitDone() {
// WiFi configuration
struct softap_config apConfig;
char ssid[33];
char password[33];
wifi_set_opmode(SOFTAP_MODE);
wifi_softap_get_config(&apConfig);
os_memset(apConfig.ssid, 0, sizeof(apConfig.ssid));
os_sprintf(ssid, "%s", "APESP");
os_memcpy(apConfig.ssid, ssid, os_strlen(ssid));
os_memset(apConfig.password, 0, sizeof(apConfig.password));
os_sprintf(password, "%s", "");
os_memcpy(apConfig.password, password, os_strlen(password));
apConfig.authmode = AUTH_OPEN;
apConfig.channel = 7;
apConfig.max_connection = 4;
apConfig.ssid_hidden = 0;
wifi_softap_set_config(&apConfig);
wifi_set_event_handler_cb(onWifiEvent);
// wifi_station_connect();
}
void ICACHE_FLASH_ATTR
user_rf_pre_init() {
}
void ICACHE_FLASH_ATTR
user_init() {
// initialise UART
uart_init(BIT_RATE_9600, BIT_RATE_9600); // 9600 baud
system_set_os_print(1);
// register post-initialisation callback
system_init_done_cb(onInitDone);
}
Statistics: Posted by crosofg — Tue Feb 02, 2016 12:16 am
Statistics: Posted by ESP_Faye — Mon Feb 01, 2016 2:23 pm
Code:
add 1
aid 1
station: 34:bb:26:6b:1d:78 join, AID = 1
server handshake start.
Fatal exception 28(LoadProhibitedCause):
epc1=0x4021520d, epc2=0x00000000, epc3=0x00000000, excvaddr=0x0000000c, depc=0x00000000
ets Jan 8 2013,rst cause:2, boot mode:(1,7)
ets Jan 8 2013,rst cause:4, boot mode:(1,7)
wdt reset
Statistics: Posted by crosofg — Sun Jan 31, 2016 5:06 pm