Skip to content

Instantly share code, notes, and snippets.

sticilface

Block or report user

Report or block sticilface

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sticilface
sticilface / spram_allocator.h
Created Mar 21, 2019
custom PSRAM STL allocator
View spram_allocator.h
template <typename T>
class spram_allocator
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef T& reference;
typedef const T& const_reference;
View surrogate.ino
/* This sketch lets a RemoteWorker device connected through Ethernet TCP act
as if it is present on the SoftwareBitBang bus connected to this Surrogate
device.
The RemoteWorker sketch can the run on a device not capable of SWBB but
with Ethernet support, like a PC or a Raspberry PI.
Surrogate and RemoteWorker examples contributed by Fred Larsen. */
#define PJON_PACKET_MAX_LENGTH 50
View router.ino
#define SERIAL_METHOD ThroughAsyncSerial // ThroughSerial or ThroughAsyncSerial
#define ROUTER_TYPE 2 // 1 = PJONVirtualBusRouter, 2 = segmented switch...
#define PJON_MAX_PACKETS 3
#define BUS_ID 253
#define PJON_BUS_PIN 2
#define PJON_INCLUDE_SWBB
#define PJON_INCLUDE_ANY
#define PJON_INCLUDE_TAS
View receiver.ino
#define USE_SERIAL
//#define USE_ACK
#define SERIAL_METHOD ThroughAsyncSerial // ThroughSerial or ThroughAsyncSerial
#define SERIAL_SPEED 115200
#define SWBB_PIN 2 // use 2 for arduino, 5 for ESP8266
#if defined (USE_SERIAL) && defined (ESP32)
#define SERIAL_PORT Serial2
@sticilface
sticilface / trans.ino
Last active Jul 29, 2018
Transmitter_speed_sketch
View trans.ino
//#define USE_SERIAL
//#define USE_ACK
#define SERIAL_METHOD ThroughAsyncSerial // ThroughSerial or ThroughAsyncSerial
#define SERIAL_SPEED 115200
#define SWBB_PIN 2 // use 2 for arduino, 5 for ESP8266
#if defined (USE_SERIAL) && defined (ESP32)
#define SERIAL_PORT Serial2
#elif defined (USE_SERIAL)
View gist:7537ee844a7cbb3a3342bc1a9322667d
#define SERIAL_METHOD ThroughSerial // ThroughSerial or ThroughAsyncSerial
#define PJON_MAX_PACKETS 3
#define PJON_BUS_PIN 2
#define PJON_INCLUDE_SWBB
#define PJON_INCLUDE_ANY
#define PJON_INCLUDE_TAS
#define PJON_INCLUDE_TS
@sticilface
sticilface / speedtests.md
Last active Jul 28, 2018
speed tests results PJON Serial
View speedtests.md

Speed Tests

ThroughSerial

Leonado to Leonado (115200 baud)

1 second communication speed test:
Packet Overhead: 10B - Total: 190B
Bandwidth: 570.00B/s

@sticilface
sticilface / test.h
Created Jun 23, 2017
Error when using PROGMEM strings and DEBUG with PSTR() in template functions
View test.h
#ifndef TEST_H
#define TEST_H
#define TEST Serial
const char testString[] PROGMEM = "Test String";
#if defined(TEST)
View Stream timeout.txt
[HTTP-Client][begin] url: http://192.168.1.42/esp/local/MySONOFF/debugsonoff/manifest.json
[HTTP-Client][begin] host: 192.168.1.42 port: 80 url: /esp/local/MySONOFF/debugsonoff/manifest.json
[hostByName] Host: 192.168.1.42 is a IP!
:ref 1
[HTTP-Client] connected to 192.168.1.42:80
:wr 183 183 0
:wrc 183 183 0
:sent 183
:rn 240
:rch 240, 946
View PROGMEM.md

Guide to PROGMEM on ESP8266 and Arduino IDE

Intro

On low memory devices like the arduino and esp8266 you do not want strings to be stored in RAM. This occurs by default on these systems. Declare a string const char * xyz = "this is a string" and it will use up RAM.

The solution on these devices is to allow strings to be stored in read only memory, in Arduino this is the PROGMEM macro. Most of my experience is with the ESP8266 which is a 32bit micros controller. This device stores PROGMEM data in flash. The macro PROGMEM on ESP8266 is simply

#define PROGMEM   ICACHE_RODATA_ATTR
You can’t perform that action at this time.