Merged remote-tracking branch 'remotes/origin/RLJ_WebSockets_I2C_OLED'

This commit is contained in:
rljonesau 2018-11-26 21:45:28 +11:00
commit ab539f0569
26 changed files with 115 additions and 822 deletions

2
.gitignore vendored
View File

@ -4,4 +4,6 @@
*.o
*.a
*.cache
.vs
__vm
/Arduino/BTCDieselHeater/.vscode/*.json

View File

@ -1,3 +0,0 @@
{
"CurrentProjectSetting": "Visual Micro"
}

View File

@ -1,7 +0,0 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\debugport.h",
"PreviewInSolutionExplorer": false
}

View File

@ -1,111 +0,0 @@
/*
Editor: https://www.visualmicro.com/
visual micro and the arduino ide ignore this code during compilation. this code is automatically maintained by visualmicro, manual changes to this file will be overwritten
the contents of the Visual Micro sketch sub folder can be deleted prior to publishing a project
all non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!).
note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again
Hardware: DOIT ESP32 DEVKIT V1, Platform=esp32, Package=esp32
*/
#if defined(_VMICRO_INTELLISENSE)
#ifndef _VSARDUINO_H_
#define _VSARDUINO_H_
#define __ESP32_ESp32__
#define __ESP32_ESP32__
#define ESP_PLATFORM
#define HAVE_CONFIG_H
#define F_CPU 240000000L
#define ARDUINO 10805
#define ARDUINO_ESP32_DEV
#define ARDUINO_ARCH_ESP32
#define ESP32
#define CORE_DEBUG_LEVEL 0
#define __cplusplus 201103L
#undef __cplusplus
#define __cplusplus 201103L
#define __STDC__
#define __ARM__
#define __arm__
#define __inline__
#define __asm__(x)
#define __asm__
#define __extension__
#define __ATTR_PURE__
#define __ATTR_CONST__
#define __volatile__
#define __ASM
#define __INLINE
#define __attribute__(noinline)
//#define _STD_BEGIN
//#define EMIT
#define WARNING
#define _Lockit
#define __CLR_OR_THIS_CALL
#define C4005
#define _NEW
//
//typedef int uint8_t;
//#define __ARMCC_VERSION 400678
//#define PROGMEM
//#define string_literal
//
//#define prog_void
//#define PGM_VOID_P int
//
typedef int _read;
typedef int _seek;
typedef int _write;
typedef int _close;
typedef int __cleanup;
//#define inline
#define __builtin_clz
#define __builtin_clzl
#define __builtin_clzll
#define __builtin_labs
#define __builtin_va_list
typedef int __gnuc_va_list;
#define __ATOMIC_ACQ_REL
#define __CHAR_BIT__
#define _EXFUN()
typedef unsigned char byte;
extern "C" void __cxa_pure_virtual() {;}
typedef long __INTPTR_TYPE__ ;
typedef long __UINTPTR_TYPE__ ;
typedef long __SIZE_TYPE__ ;
typedef long __PTRDIFF_TYPE__;
#include <arduino.h>
#include <pins_arduino.h>
//#include "..\generic\Common.h"
//#include "..\generic\pins_arduino.h"
//#undef F
//#define F(string_literal) ((const PROGMEM char *)(string_literal))
//#undef PSTR
//#define PSTR(string_literal) ((const PROGMEM char *)(string_literal))
//current vc++ does not understand this syntax so use older arduino example for intellisense
//todo:move to the new clang/gcc project types.
#define interrupts() sei()
#define noInterrupts() cli()
#include "SenderTrial2.ino"
#endif
#endif

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,93 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="BTCDieselHeater.ino" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="__vm\.BTCDieselHeater.vsarduino.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BluetoothAbstract.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BluetoothESP32.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BluetoothHC05.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BTCConfig.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BTCota.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BTCWifi.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="debugport.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="NVStorage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="pins.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Protocol.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SmartError.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TxManage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BTCWebServer.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="BluetoothESP32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BluetoothHC05.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BTCota.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BTCWifi.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="NVStorage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Protocol.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SmartError.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TxManage.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BTCWebServer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>

View File

@ -52,6 +52,7 @@ void initWebServer(void) {
webSocket.onEvent(webSocketEvent);
DebugPort.println("HTTP server started");
}
unsigned char cVal;
void doWebServer(void) {
static unsigned long lastTx = 0;

File diff suppressed because one or more lines are too long

View File

@ -1,103 +0,0 @@
/*
WiFiTelnetToSerial - Example Transparent UART to Telnet Server for ESP32
Copyright (c) 2017 Hristo Gochkov. All rights reserved.
This file is part of the ESP32 WiFi library for Arduino environment.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <WiFi.h>
#include <WiFiMulti.h>
WiFiMulti wifiMulti;
//how many clients should be able to telnet to this ESP32
#define MAX_SRV_CLIENTS 1
const char* ssid = "Derpina";
const char* password = "randomsharedkey1";
WiFiServer server(23);
WiFiClient serverClients[MAX_SRV_CLIENTS];
void setup() {
Serial.begin(115200);
Serial.println("\nConnecting");
wifiMulti.addAP(ssid, password);
wifiMulti.addAP("ssid_from_AP_2", "your_password_for_AP_2");
wifiMulti.addAP("ssid_from_AP_3", "your_password_for_AP_3");
Serial.println("Connecting Wifi ");
for (int loops = 10; loops > 0; loops--) {
if (wifiMulti.run() == WL_CONNECTED) {
Serial.println("");
Serial.print("WiFi connected ");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
break;
}
else {
Serial.println(loops);
delay(1000);
}
}
if (wifiMulti.run() != WL_CONNECTED) {
Serial.println("WiFi connect failed");
delay(1000);
ESP.restart();
}
//start UART and the server
server.begin();
server.setNoDelay(true);
Serial.print("Ready! Use 'telnet ");
Serial.print(WiFi.localIP());
Serial.println(" 23' to connect");
}
int testval=0;
void loop() {
testval=testval+1;
uint8_t i;
Serial.println(testval);
if (wifiMulti.run() == WL_CONNECTED) {
//check if there are any new clients
if (server.hasClient()){
for(i = 0; i < MAX_SRV_CLIENTS; i++){
//find free/disconnected spot
if (!serverClients[i] || !serverClients[i].connected()){
if(serverClients[i]) serverClients[i].stop();
serverClients[i] = server.available();
if (!serverClients[i]) Serial.println("available broken");
Serial.print("New client: ");
Serial.print(i); Serial.print(' ');
Serial.println(serverClients[i].remoteIP());
break;
server.print(Serial.read());
}
}
if (i >= MAX_SRV_CLIENTS) {
//no free/disconnected spot so reject
server.available().stop();
}
}
}
else {
Serial.println("WiFi not connected!");
for(i = 0; i < MAX_SRV_CLIENTS; i++) {
if (serverClients[i]) serverClients[i].stop();
}
delay(1000);
}
}

View File

@ -1,111 +0,0 @@
/*
Editor: https://www.visualmicro.com/
visual micro and the arduino ide ignore this code during compilation. this code is automatically maintained by visualmicro, manual changes to this file will be overwritten
the contents of the Visual Micro sketch sub folder can be deleted prior to publishing a project
all non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!).
note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again
Hardware: DOIT ESP32 DEVKIT V1, Platform=esp32, Package=esp32
*/
#if defined(_VMICRO_INTELLISENSE)
#ifndef _VSARDUINO_H_
#define _VSARDUINO_H_
#define __ESP32_ESp32__
#define __ESP32_ESP32__
#define ESP_PLATFORM
#define HAVE_CONFIG_H
#define F_CPU 240000000L
#define ARDUINO 10805
#define ARDUINO_ESP32_DEV
#define ARDUINO_ARCH_ESP32
#define ESP32
#define CORE_DEBUG_LEVEL 0
#define __cplusplus 201103L
#undef __cplusplus
#define __cplusplus 201103L
#define __STDC__
#define __ARM__
#define __arm__
#define __inline__
#define __asm__(x)
#define __asm__
#define __extension__
#define __ATTR_PURE__
#define __ATTR_CONST__
#define __volatile__
#define __ASM
#define __INLINE
#define __attribute__(noinline)
//#define _STD_BEGIN
//#define EMIT
#define WARNING
#define _Lockit
#define __CLR_OR_THIS_CALL
#define C4005
#define _NEW
//
//typedef int uint8_t;
//#define __ARMCC_VERSION 400678
//#define PROGMEM
//#define string_literal
//
//#define prog_void
//#define PGM_VOID_P int
//
typedef int _read;
typedef int _seek;
typedef int _write;
typedef int _close;
typedef int __cleanup;
//#define inline
#define __builtin_clz
#define __builtin_clzl
#define __builtin_clzll
#define __builtin_labs
#define __builtin_va_list
typedef int __gnuc_va_list;
#define __ATOMIC_ACQ_REL
#define __CHAR_BIT__
#define _EXFUN()
typedef unsigned char byte;
extern "C" void __cxa_pure_virtual() {;}
typedef long __INTPTR_TYPE__ ;
typedef long __UINTPTR_TYPE__ ;
typedef long __SIZE_TYPE__ ;
typedef long __PTRDIFF_TYPE__;
#include <arduino.h>
#include <pins_arduino.h>
//#include "..\generic\Common.h"
//#include "..\generic\pins_arduino.h"
//#undef F
//#define F(string_literal) ((const PROGMEM char *)(string_literal))
//#undef PSTR
//#define PSTR(string_literal) ((const PROGMEM char *)(string_literal))
//current vc++ does not understand this syntax so use older arduino example for intellisense
//todo:move to the new clang/gcc project types.
#define interrupts() sei()
#define noInterrupts() cli()
#include "BTCDieselHeater.ino"
#endif
#endif

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,50 +0,0 @@
//#define SERIAL DebugPort
#define SERIAL SerialAndTelnet
#include "BTCTelnetSpy.h"
TelnetSpy SerialAndTelnet;
void waitForConnection() {
while (WiFi.status() != WL_CONNECTED) {
delay(500);
SerialAndTelnet.print(".");
}
SerialAndTelnet.println(" Connected!");
}
void waitForDisconnection() {
while (WiFi.status() == WL_CONNECTED) {
delay(500);
SerialAndTelnet.print(".");
}
SerialAndTelnet.println(" Disconnected!");
}
void telnetConnected() {
SerialAndTelnet.println("Telnet connection established.");
}
void telnetDisconnected() {
SerialAndTelnet.println("Telnet connection closed.");
}
void initTelnetSpy() {
SerialAndTelnet.setWelcomeMsg("Welcome to the TelnetSpy example\n\n");
SerialAndTelnet.setCallbackOnConnect(telnetConnected);
SerialAndTelnet.setCallbackOnDisconnect(telnetDisconnected);
waitForConnection();
/*
SerialAndTelnet.println("Ready");
SerialAndTelnet.print("IP address: ");
SerialAndTelnet.println(WiFi.localIP());
SerialAndTelnet.println("\nType 'C' for WiFi connect.\nType 'D' for WiFi disconnect.\nType 'R' for WiFi reconnect.");
SerialAndTelnet.println("All other chars will be echoed. Play around...\n");
*/
}
void DoTelnetSpy() {
SerialAndTelnet.handle();
}

View File

@ -1,10 +0,0 @@
#include <Arduino.h>
#include "BTCWifi.h"
#include <TelnetSpy.h>
void initTelnetSpy();
void DoTelnetSpy();
void waitForConnection();
void waitForDisconnection();
void telnetConnected();
void telnetDisconnected();

Binary file not shown.

Binary file not shown.