Skip to content

Commit

Permalink
Async WiFi Implementation (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecoreng authored Oct 15, 2023
1 parent 559ffd8 commit 6bdf9b1
Show file tree
Hide file tree
Showing 12 changed files with 673 additions and 306 deletions.
7 changes: 3 additions & 4 deletions lib/EspSimHub/BoardDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

// This is used as a hint for the IDE, but the real values should come from platformio.ini environment
// as a matter of fact, you need to comment out BOTH if you are compiling for both environments
// #define ESP32 // if using ESP8266, comment out
#define ESP8266 // if using ESP32, comment out
// #define ESP32 true // if using ESP8266, comment out
#define ESP8266 true // if using ESP32, comment out

// PIN Aliases no longer here,
// Use GPIO_NUM_XX instead of D1, D2, etc
// PIN Aliases no longer here, use numbers
2 changes: 2 additions & 0 deletions lib/FullLoopbackStream/FullLoopbackStream.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include <LoopbackStream.h>

/**
Expand Down
140 changes: 0 additions & 140 deletions lib/TcpSerialBridge/TcpSerialBridge.cpp

This file was deleted.

35 changes: 0 additions & 35 deletions lib/TcpSerialBridge/TcpSerialBridge.h

This file was deleted.

26 changes: 26 additions & 0 deletions lib/TcpSerialBridge2/ECrowneWifi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <TcpSerialBridge2.h>
#include <FullLoopbackStream.h>

TcpSerialBridge2 instance(BRIDGE_PORT);

class ECrowneWifi {
public:
static void setup(FullLoopbackStream *outgoingStream, FullLoopbackStream *incomingStream) {
instance.setup(outgoingStream, incomingStream);
}
static void loop() {
instance.loop();
}
static void flush() {
instance.flush();
}
};

// these will override the Serial interface that SimHub uses to use our Streams
#define FlowSerialBegin [](unsigned long baud) {}
#define StreamRead incomingStream.read
#define StreamAvailable incomingStream.available
#define FlowSerialFlush ECrowneWifi::flush
#define StreamFlush ECrowneWifi::flush
#define StreamWrite outgoingStream.write
#define StreamPrint outgoingStream.print
Loading

0 comments on commit 6bdf9b1

Please sign in to comment.