Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp8266: fixes with core dev version #62

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
5 changes: 3 additions & 2 deletions lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ void OLEDDisplay::drawFastImage(int16_t xMove, int16_t yMove, int16_t width, int

void OLEDDisplay::drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const char *xbm) {
int16_t widthInXbm = (width + 7) / 8;
uint8_t data;
uint8_t data = 0;

for(int16_t y = 0; y < height; y++) {
for(int16_t x = 0; x < width; x++ ) {
Expand Down Expand Up @@ -388,6 +388,7 @@ void OLEDDisplay::drawStringInternal(int16_t xMove, int16_t yMove, char* text, u
case TEXT_ALIGN_RIGHT:
xMove -= textWidth;
break;
case TEXT_ALIGN_LEFT:;
}

// Don't draw anything if it is not on the screen.
Expand Down Expand Up @@ -719,7 +720,7 @@ void inline OLEDDisplay::drawInternal(int16_t xMove, int16_t yMove, int16_t widt
int16_t xPos = xMove + (i / rasterHeight);
int16_t yPos = ((yMove >> 3) + (i % rasterHeight)) * DISPLAY_WIDTH;

int16_t yScreenPos = yMove + yOffset;
//int16_t yScreenPos = yMove + yOffset;
int16_t dataPos = xPos + yPos;

if (dataPos >= 0 && dataPos < DISPLAY_BUFFER_SIZE &&
Expand Down
4 changes: 2 additions & 2 deletions lib/ESP8266_Oled_Driver_for_SSD1306_display/OLEDDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ class OLEDDisplay : public Print {
char *logBuffer = NULL;

// Send a command to the display (low level function)
virtual void sendCommand(uint8_t com) {};
virtual void sendCommand(uint8_t com) { (void)com; };

// Connect to the display
virtual bool connect() {};
virtual bool connect() { return false; };

// Send all the init commands
void sendInitCommands();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ void OLEDDisplayUi::drawFrame(){
x1 = 0;
y1 = y - 64;
break;
default:
return;
}

// Invert animation if direction is reversed.
Expand Down Expand Up @@ -331,7 +333,7 @@ void OLEDDisplayUi::drawIndicator() {
return;
}

uint8_t posOfHighlightFrame;
uint8_t posOfHighlightFrame = 0;
float indicatorFadeProgress = 0;

// if the indicator needs to be slided in we want to
Expand Down
2 changes: 1 addition & 1 deletion lib/Streaming/src/Streaming.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ inline Print &operator <<(Print &obj, const _FLOAT &arg)
enum _EndLineCode { endl };

inline Print &operator <<(Print &obj, _EndLineCode arg)
{ obj.println(); return obj; }
{ (void)arg; obj.println(); return obj; }

#endif
2 changes: 1 addition & 1 deletion lib/aes/AES-128_V10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static unsigned char AES_Sub_Byte(unsigned char Byte);
static void AES_Shift_Rows();
static void AES_Mix_Collums();
static void AES_Calculate_Round_Key(unsigned char Round, unsigned char *Round_Key);
static void Send_State();
//static void Send_State();

/*
*****************************************************************************************
Expand Down
28 changes: 14 additions & 14 deletions src/ESP-sc-gway.ino
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ uint8_t pdebug= P_MAIN ; // Initially only MAIN and GUI
# endif //_GPS
#endif //_GATEWAYNODE

using namespace std;
//using namespace std;
byte currentMode = 0x81;
bool sx1272 = false; // Actually we use sx1276/RFM95
uint8_t MAC_array[6];
Expand Down Expand Up @@ -238,7 +238,7 @@ int sendPacket(uint8_t *buf, uint8_t length); // _txRx.ino forward
void printIP(IPAddress ipa, const char sep, String & response); // _wwwServer.ino
void setupWWW(); // _wwwServer.ino forward

void mPrint(String txt); // _utils.ino
void mPrint(const String& txt); // _utils.ino
int getNtpTime(time_t *t); // _utils.ino
int mStat(uint8_t intr, String & response); // _utils.ino
void SerialStat(uint8_t intr); // _utils.ino
Expand Down Expand Up @@ -292,7 +292,7 @@ void setup() {

char MAC_char[19]; // XXX Unbelievable
MAC_char[18] = 0;
char hostname[12]; // hostname space
char hostname[32]; // hostname space

initConfig(&gwayConfig);

Expand Down Expand Up @@ -363,14 +363,14 @@ void setup() {
//
if (readGwayCfg(_CONFIGFILE, &gwayConfig) > 0) { // read the Gateway Config
# if _MONITOR>=1
if (debug>=0) {
if (debug>=1) {
mPrint("readGwayCfg:: return OK");
}
# endif
}
else {
# if _MONITOR>=1
if (debug>=0) {
if (debug>=1) {
mPrint("setup:: readGwayCfg: ERROR readGwayCfg Failed");
}
# endif
Expand Down Expand Up @@ -402,7 +402,7 @@ void setup() {
// Setup WiFi UDP connection. Give it some time and retry x times. '0' means try forever
while (WlanConnect(0) <= 0) {
# if _MONITOR>=1
if ((debug>=0) && (pdebug & P_MAIN)) {
if ((debug>=1) && (pdebug & P_MAIN)) {
mPrint("setup:: Error Wifi network connect(0)");
}
# endif //_MONITOR
Expand All @@ -429,7 +429,7 @@ void setup() {
# endif //ESP32_ARCH

# if _MONITOR>=1
if (debug>=0) {
if (debug>=1) {
String response = "Host=";
# if defined(ESP32_ARCH)
response += String(WiFi.getHostname());
Expand Down Expand Up @@ -487,7 +487,7 @@ void setup() {
// display results of getting hardware address
//
# if _MONITOR>=1
if (debug>=0) {
if (debug>=1) {
String response= "Gateway ID: ";
printHexDigit(MAC_array[0], response);
printHexDigit(MAC_array[1], response);
Expand Down Expand Up @@ -531,8 +531,8 @@ void setup() {
time_t newTime;
if (getNtpTime(&newTime)<=0) {
# if _MONITOR>=1
if (debug>=0) {
mPrint("setup:: ERROR Time not set (yet). Time="+String(newTime) );
if (debug>=1) {
mPrint("setup:: ERROR Time not set (yet). Time="+String((int)newTime) );
}
# endif //_MONITOR
response += ".";
Expand All @@ -549,7 +549,7 @@ void setup() {
// When we are here we succeeded in getting the time
startTime = now(); // Time in seconds
# if _MONITOR>=1
if (debug>=0) {
if (debug>=1) {
String response= "Time set=";
stringTime(now(),response);
mPrint(response);
Expand Down Expand Up @@ -670,7 +670,7 @@ void loop ()
// We will not read Udp in this loop cycle if not connected to Wlan
if (WlanConnect(1) < 0) {
# if _MONITOR>=1
if ((debug>=0) && (pdebug & P_MAIN)) {
if ((debug>=1) && (pdebug & P_MAIN)) {
mPrint("loop:: ERROR reconnect WLAN");
}
# endif //_MONITOR
Expand Down Expand Up @@ -701,7 +701,7 @@ void loop ()
//
if (readUdp(packetSize) < 0) {
# if _MONITOR>=1
if (debug>=0)
if (debug>=1)
mPrint("v readUdp ERROR, returning < 0");
# endif //_MONITOR
break;
Expand Down Expand Up @@ -882,7 +882,7 @@ void loop ()
if (getNtpTime(&newTime)<=0) {
# if _MONITOR>=1
if (debug>=2) {
mPrint("loop:: WARNING Time not set (yet). Time="+String(newTime) );
mPrint("loop:: WARNING Time not set (yet). Time="+String((int)newTime) );
}
# endif //_MONITOR
}
Expand Down
18 changes: 9 additions & 9 deletions src/_WiFi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int WlanStatus() {
// The ESP is configured to reconnect to the last router in memory.
case WL_DISCONNECTED:
# if _MONITOR>=1
if ( debug>=0 ) {
if ( debug>=1 ) {
mPrint("WlanStatus:: DISCONNECTED, IP=" + String(WiFi.localIP().toString())); // 6
}
# endif
Expand All @@ -58,7 +58,7 @@ int WlanStatus() {
// When still pocessing
case WL_IDLE_STATUS:
# if _MONITOR>=1
if ( debug>=0 ) {
if ( debug>=1 ) {
mPrint("WlanStatus:: IDLE"); // 0
}
# endif //_MONITOR
Expand All @@ -68,30 +68,30 @@ int WlanStatus() {
// Whene detected, the program will search for a better AP in range
case WL_NO_SSID_AVAIL:
# if _MONITOR>=1
if ( debug>=0 )
if ( debug>=1 )
mPrint("WlanStatus:: NO SSID"); // 1
# endif //_MONITOR
break;

case WL_CONNECT_FAILED:
# if _MONITOR>=1
if ( debug>=0 )
if ( debug>=1 )
mPrint("WlanStatus:: Connect FAILED"); // 4
# endif //_MONITOR
break;

// Never seen this code
case WL_SCAN_COMPLETED:
# if _MONITOR>=1
if ( debug>=0 )
if ( debug>=1 )
mPrint("WlanStatus:: SCAN COMPLETE"); // 2
# endif //_MONITOR
break;

// Never seen this code
case WL_CONNECTION_LOST:
# if _MONITOR>=1
if ( debug>=0 )
if ( debug>=1 )
mPrint("WlanStatus:: Connection LOST"); // 5
# endif //_MONITOR
break;
Expand All @@ -100,14 +100,14 @@ int WlanStatus() {
// before accessing WiFi functions
case WL_NO_SHIELD:
# if _MONITOR>=1
if ( debug>=0 )
if ( debug>=1 )
mPrint("WlanStatus:: WL_NO_SHIELD"); //
# endif //_MONITOR
break;

default:
# if _MONITOR>=1
if ( debug>=0 ) {
if ( debug>=1 ) {
mPrint("WlanStatus Error:: code=" + String(WiFi.status())); // 255 means ERROR
}
# endif //_MONITOR
Expand Down Expand Up @@ -286,7 +286,7 @@ int WlanConnect(int maxTry) {
agains++;
delay(8000); // delay(agains*500);
# if _MONITOR>=1
if ( debug>=0 ) {
if ( debug>=1 ) {
Serial.print("."); // Serial only
}
# endif //_MONITOR
Expand Down
11 changes: 7 additions & 4 deletions src/_loraFiles.ino
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int initMonitor(struct moniLine *monitor)
void id_print (String id, String val)
{
#if _MONITOR>=1
if ((debug>=0) && (pdebug & P_MAIN)) {
if ((debug>=1) && (pdebug & P_MAIN)) {
Serial.print(id);
Serial.print(F("=\t"));
Serial.println(val);
Expand Down Expand Up @@ -172,7 +172,7 @@ int readConfig(const char *fn, struct espGwayConfig *c)
while (f.available()) {

# if _MONITOR>=1
if ((debug>=0) && (pdebug & P_MAIN)) {
if ((debug>=1) && (pdebug & P_MAIN)) {
Serial.print('.');
}
# endif //_MONITOR
Expand All @@ -183,7 +183,7 @@ int readConfig(const char *fn, struct espGwayConfig *c)
if (tries >= 15) {
f.close();
# if _MONITOR>=1
if (debug>=0) {
if (debug>=1) {
mPrint("readConfig:: Formatting");
}
# endif //_MONITOR
Expand Down Expand Up @@ -494,7 +494,10 @@ int addLog(const unsigned char * line, int cnt)

f.close(); // Close the file after appending to it

#endif //_STAT_LOG
#else //!_STAT_LOG
(void)line;
(void)cnt;
#endif //!_STAT_LOG

gwayConfig.logFileRec++;

Expand Down
6 changes: 3 additions & 3 deletions src/_loraModem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ uint8_t receivePkt(uint8_t *payload)
if (irqflags & IRQ_LORA_CRCERR_MASK) // Is CRC error?
{
# if _MONITOR>=1
if ((debug>=0) && (pdebug & P_RADIO)) {
if ((debug>=1) && (pdebug & P_RADIO)) {
String response=("rxPkt:: Err CRC, t=");
stringTime(now(), response);
mPrint(response);
Expand All @@ -445,7 +445,7 @@ uint8_t receivePkt(uint8_t *payload)
else if ((irqflags & IRQ_LORA_HEADER_MASK) == false) // Header not ok?
{
# if _MONITOR>=1
if ((debug>=0) && (pdebug & P_RADIO)) {
if ((debug>=1) && (pdebug & P_RADIO)) {
mPrint("rxPkt:: Err HEADER");
}
# endif //_MONITOR
Expand Down Expand Up @@ -484,7 +484,7 @@ uint8_t receivePkt(uint8_t *payload)

if (receivedCount > PAYLOAD_LENGTH) {
# if _MONITOR>=1
if ((debug>=0) & (pdebug & P_RADIO)) {
if ((debug>=1) & (pdebug & P_RADIO)) {
mPrint("rxPkt:: ERROR Payliad receivedCount="+String(receivedCount));
}
# endif //_MONITOR
Expand Down
Loading