Skip to content

Instantly share code, notes, and snippets.

View mcspr's full-sized avatar
⚕️
don't let it steal your eyes

Max Prokhorov mcspr

⚕️
don't let it steal your eyes
View GitHub Profile
Environment Downloads
itead-sonoff-rfbridge 2303
itead-sonoff-basic 2180
itead-sonoff-pow 1163
itead-s20 831
itead-sonoff-th 757
nodemcu-lolin 663
itead-sonoff-basic-dht 441
itead-sonoff-rf 423
@mcspr
mcspr / broker.cpp
Created February 1, 2019 16:31
Possible broker implementation
#include <functional>
#include <iostream>
#include <vector>
template <typename Event>
class Broker {
public:
virtual ~Broker() {}
@mcspr
mcspr / mtu_break.ino
Last active March 21, 2019 19:14
esp8266/Arduino MTU test
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESPAsyncWebServer.h>
#include <AsyncWebSocket.h>
#include "mtu_break_progmem.h"
AsyncWebServer server(80);
AsyncWebSocket ws("/ws");
@mcspr
mcspr / espasyncwebserver.patch
Last active April 3, 2019 19:49
Check ~100ms WS stream
diff --git a/src/AsyncWebSocket.cpp b/src/AsyncWebSocket.cpp
index f507aa7..9499414 100644
--- a/src/AsyncWebSocket.cpp
+++ b/src/AsyncWebSocket.cpp
@@ -536,6 +536,7 @@ void AsyncWebSocketClient::_runQueue(){
while(!_messageQueue.isEmpty() && _messageQueue.front()->finished()){
_messageQueue.remove(_messageQueue.front());
}
+ Serial.printf("> _runQueue() size:%u heap:%u\n", _messageQueue.length(), ESP.getFreeHeap());
#include <Arduino.h>
#ifdef ESP8266
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#elif ESP32
#include <WiFi.h>
#include <AsyncTCP.h>
#endif
Import("env")
import os
PROJECT_CFG = env.GetProjectConfig()
STORAGE = os.path.join(env["PROJECT_DIR"], PROJECT_CFG.get("common", "shared_libdeps_dir"))
LIB_DEPS = env.GetProjectOption("lib_deps")
#print("using", STORAGE)
@mcspr
mcspr / hsv.cpp
Last active August 20, 2019 14:17
HSV test
$ g++ -std=c++17 -o hsv hsv.cpp
$ ./hsv 2,100,59
brightness=0, rgb=0,0,0
input=2,100,59
_setRGBInputValue(255,8,0)
brightness=150, rgb=255,8,0
diff --git a/tools/sdk/lwip2/include/lwipopts.h b/tools/sdk/lwip2/include/lwipopts.h
index 22acb6b4..fcd7ba4e 100644
--- a/tools/sdk/lwip2/include/lwipopts.h
+++ b/tools/sdk/lwip2/include/lwipopts.h
@@ -3571,9 +3571,9 @@ extern "C" {
#define SNTP_SET_SYSTEM_TIME_US(t,us) do { struct timeval tv = { t, us }; settimeofday(&tv, NULL); } while (0)
#define SNTP_UPDATE_DELAY_DEFAULT 3600000
-#define SNTP_SUPPRESS_DELAY_CHECK 1
-#define SNTP_UPDATE_DELAY sntp_update_delay_not_less_than_15000
arrays
{"relays":{"gpio":[15,15,15,15,15,15,15,15,15,15],"type":[1,1,1,1,1,1,1,1,1,1],"reset":[153,153,153,153,153,153,153,153,153,153],"boot":[2,2,2,2,2,2,2,2,2,2],"pulse":[1,1,1,1,1,1,1,1,1,1],"pulse_time":[3600,3600,3600,3600,3600,3600,3600,3600,3600,3600],"group":["something/else","something/else","something/else","something/else","something/else","something/else","something/else","something/else","something/else","something/else"],"group_sync":[2,2,2,2,2,2,2,2,2,2],"on_disc":[0,0,0,0,0,0,0,0,0,0]}}
objs
{"relays":[{"gpio":15,"type":1,"reset":153,"boot":2,"pulse":1,"pulse_time":3600,"group":"something/else","group_sync":2,"on_disc":0},{"gpio":15,"type":1,"reset":153,"boot":2,"pulse":1,"pulse_time":3600,"group":"something/else","group_sync":2,"on_disc":0},{"gpio":15,"type":1,"reset":153,"boot":2,"pulse":1,"pulse_time":3600,"group":"something/else","group_sync":2,"on_disc":0},{"gpio":15,"type":1,"reset":153,"boot":2,"pulse":1,"pulse_time":3600,"group":"something/else","group_sync":2,"on_disc":0},{"gpio":15
@mcspr
mcspr / runme.cpp
Last active October 24, 2019 12:53
#include <ArduinoJson.h>
#include <iostream>
int main(int argc, char **argv) {
DynamicJsonBuffer buffer(1024);
JsonObject& shared = buffer.createObject();
JsonObject& a = buffer.createObject();
JsonObject& b = buffer.createObject();