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

GoogleDocs.ino does not compile #70

Closed
pierangelof opened this issue Nov 26, 2018 · 12 comments
Closed

GoogleDocs.ino does not compile #70

pierangelof opened this issue Nov 26, 2018 · 12 comments

Comments

@pierangelof
Copy link

Hi,
first of all I would like to thank you for this great library.

I have updated the esp8266 library to the latest version (2.4.2) and your example does not compile anymore. This is the error I get:

Arduino: 1.8.7 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, 4M (3M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

Build options changed, rebuilding all
sketch\GoogleDocs.ino.cpp.o:(.text.setup+0x10): undefined reference to `g_cont'

collect2.exe: error: ld returned 1 exit status

It seems that in the latest library was changed some flag of the compiler but I am not to solve the issue.

Thank you very much for your support.

@edugargon
Copy link

I have the same problem.
I have removed all references to g_count in the .ino file and compiles correctly but:

"
Connecting to script.google.com
Connection failed. Retrying...
Connection failed. Retrying...
Connection failed. Retrying...
Connection failed. Retrying...
Connection failed. Retrying...
Could not connect to server: script.google.com
Exiting...

Unhandled exception: std::bad_alloc

stack>>>

ctx: cont
sp: 3ffffc60 end: 3fffffc0 offset: 01b0
3ffffe10: 00000000 00000000 00000000 00000000
3ffffe20: 00000000 3ffffebc 00000000 3ffffeb8
3ffffe30: 3ffffeb4 00000000 00000000 00000000
3ffffe40: 00000000 3ffe84e0 3ffe8849 3fff83cc
3ffffe50: 3fff941c 00000001 3fff941c 40211ecc
3ffffe60: 3ffffea4 00000000 3fff941c 4020584d
3ffffe70: 00000000 00000000 00000000 40209ed0
3ffffe80: 40000000 00000000 00000000 402116c8
3ffffe90: 00000000 00000000 00000000 00000000
3ffffea0: 3ffe8849 3ffe84e0 3fff941c 40211709
3ffffeb0: 3fff941c 40211e08 3fff941c 40211e7f
3ffffec0: 00000000 3fff83cc 00004145 40212009
3ffffed0: 00000000 00000000 3fff83cc 40211764
3ffffee0: 3ffee9b0 3fff83cc 3fff83cc 40206be7
3ffffef0: 00000000 3fffff50 40205900 3fffefa0
3fffff00: 00000000 00000000 00003a98 402015c7
3fffff10: 00000000 3fff83cc 3fff85c4 40203d1a
3fffff20: 000001bb 00000000 3fff84c8 3ffe84e0
3fffff30: 000001bb 3fff83cc 3ffe8849 3ffe84e0
3fffff40: 000001bb 3fff83cc 3ffe8849 40206de2
3fffff50: 40208130 ee10d9ac 3fff83cc 40205fbb
3fffff60: 3ffeefd8 3ffe84e0 3ffeefe4 40202a5d
3fffff70: 3ffe84e0 3ffeefe4 3ffef0b4 40202998
3fffff80: 40208130 0502a8c0 feefeffe feefeffe
3fffff90: feefeffe feefeffe feefeffe 3ffef1dc
3fffffa0: 3fffdad0 00000000 3ffef1a8 402059ac
3fffffb0: feefeffe feefeffe 3ffe851c 40100911
<<<stack<<<

last failed alloc call: 40212014(16709)

ets Jan 8 2013,rst cause:2, boot mode:(1,6)

ets Jan 8 2013,rst cause:4, boot mode:(1,6)

wdt reset
"

Thank you very much.

@electronicsguy
Copy link
Owner

@pierangelof & @edugargon I'll check with the latest versions of the libraries and update you soon. thanks.

@pierangelof
Copy link
Author

pierangelof commented Dec 22, 2018 via email

@electronicsguy
Copy link
Owner

@pierangelof & @edugargon Updated for compatibility with latest version of esp8266 library (2.5.0-beta2). Please use this and report back.

@edugargon
Copy link

edugargon commented Dec 24, 2018

thank you @electronicsguy
my case maybe it's different because I'm using a module esp01 simply as a wifi gateway on an arduino board, I'm programming on an arduinoUno board, and the esp8266wifi.h library I think is not compatible with ArduinoUNO, and I'm using the esp8266.h library only for the wifi connection.
I will try with the new version and comment again.

@electronicsguy
Copy link
Owner

esp8266 is a standalone micro-controller. You don't need an arduino to use esp8266 unless you want extra inputs or analog inputs.

@edugargon
Copy link

edugargon commented Dec 25, 2018

I precisely use arduinoUNO because I need several analog inputs, an LCD screen, an NFC reader, a relay and several LEDs... and I trying this with ESP01 with SoftwareSerial.h on ArduinoUNO board.
Thank you @electronicsguy

@electronicsguy
Copy link
Owner

Ok. So program the esp8266 board separately and then connect it to the Arduino board.

@Alpol2019
Copy link

I have a similar problem after compilation. I set the PrintIn interrupt before executing the function (client-> connect (host, httpsPort). Program Aborted at this point. Help solve this problem. I used esp8266-01

@electronicsguy
Copy link
Owner

@Alpol2019 The script and library has been tested multiple times by multiple people and it works for them, including on esp8266-01. There is something wrong on your side. You need to post more information. Try to dump the debug logs and we can see why it's aborting.

Also, in the meantime, try using a different wifi access point.

@Alpol2019
Copy link

II used working scetch and followed the instruction of the author. It may willl be a mistake on my side. I am attaching the source code and debug. I will be especially grateful to you if you find error.

#include <ESP8266WiFi.h>
#include "HTTPSRedirect.h"
#include "DebugMacros.h"

// Fill ssid and password with your network credentials
const char* ssid = "--------------";
const char* password = "--------";
//-------------------------------------
HTTPSRedirect* client = nullptr;
//--------------------------------------
const char* host = "script.google.com";
const char* googleRedirHost = "script.googleusercontent.com";
// Replace with your own script id to make server side changes
// New spreadsheetID july 2019
//const char *GScriptId = "AKfycbzmxHIksfDsmQOXVxHq9Fd67KsNMWtMJF_JuNutvoQv14T46co";
// scriptID
//AKfycbwrFY95-vkOstegQKpdIdv1mjLgjyNQvGH-lZ0JcxzuS-QB1yY
//const char *GScriptId = "--------------------------------------------";
int cn = 0;
const int httpsPort = 443;

// echo | openssl s_client -connect script.google.com:443 |& openssl x509 -fingerprint -noout
//const char* fingerprint = "";
//const uint8_t fingerprint[20] = {};
//------------------------------------------------------------------
//const char* fingerprint ="55 5F 55 54 67 1B 98 31 11 A8 45 55 95 D4 CE 3F 80 90 5D A7"; ///// replace
const char* fingerprint ="F0 5C 74 77 3F 6B 25 D7 3B 66 4D 43 2F 7E BC 5B E9 28 86 AD"; ///// replace
void setup() {
Serial.begin(115200);
Serial.println();
Serial.print("Connecting to wifi: ");
Serial.println(ssid);
// flush() is needed to print the above (connecting...) message reliably,
// in case the wireless connection doesn't go through
Serial.flush();

WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
//----------------------------------------------------------------
// Use HTTPSRedirect class to create TLS connection

// HTTPSRedirect client(httpsPort);
//-----------------------------------------------
// Use HTTPSRedirect class to create a new TLS connection
client = new HTTPSRedirect(httpsPort);
client->setInsecure();
client->setPrintResponseBody(true);
client->setContentTypeHeader("application/json");
//-----------------------------------------------------
Serial.print("Connecting to ");
Serial.println(host);

bool flag = false;
for (int i=0; i<5; i++){
// int retval = client.connect(host, httpsPort);
int retval = client->connect(host, httpsPort);
if (retval == 1) {
flag = true;
break;
}
else
Serial.println("Connection failed. Retrying...");
}

Serial.flush();
if (!flag){
Serial.print("Could not connect to server: ");
Serial.println(host);
Serial.println("Exiting...");
return;
}

Serial.flush();
// if (client.verify(fingerprint, host)) {
if (client->verify(fingerprint, host)) {
Serial.println("Certificate match.");
} else {
Serial.println("Certificate mis-match");
}

}

//funtion URL
String urlpacket( String GScriptId,String Address, String Message , String subject) {

//replace - remplazo " " for "+" para envio atravez de url, for send via url
Message.replace(" ", "+");
subject.replace(" ", "+");

String url = String("/macros/s/") + GScriptId + "/exec?"+ "Address=" + Address + "&Message=" + Message + "&subject="+ subject + "&sendMail=ok";
return url;
}
//------------------------------------------------------------
void loop()
{
//HTTPSRedirect client(httpsPort);
//-----------------------------------------------
// Use HTTPSRedirect class to create a new TLS connection
client = new HTTPSRedirect(httpsPort);
client->setInsecure();
client->setPrintResponseBody(true);
client->setContentTypeHeader("application/json");
//-------------------------------------------------
// if (!client.connected())
if (!client->connected()) { // connect to the gmail server on port 443
Serial.println("Connection with Gmail failed");
// client->stop();
// return -1;
// break;
}
// client.connect(host, httpsPort);
client->connect(host, httpsPort);
Serial.println("run...");
String Address ="----------@gmail.com"; ///Email address
String subject ="Send Mail from esp8266-01 (Alex Pol) ";
String Message ="Alarm - Main door is open";
//--------------------------------------------------------
if (cn==10)
{
//Counter = 10 send Mail //// Contador = 10 envia correo
// Write to Google Spreadsheet
String urlout= urlpacket(GScriptId,Address,Message,subject);
// client.printRedir(urlout, host, googleRedirHost);
client->GET(urlout,host);
Serial.println("Mail sending to "+ Address);
Serial.println("===============================================================");
}
cn++;
Serial.println(cn);
delay(5000); //delay 5 sec.
// delay(20000); //delay
}
-------------------------------debug and display------------------------------------------
.
WiFi connected
IP address:
192.168.0.20
Connecting to script.google.com
Certificate match.
Connection with Gmail failed

Abort called

stack>>>

ctx: cont
sp: 3ffffcf0 end: 3fffffc0 offset: 01b0
3ffffea0: 00000000 00000000 3fff7554 4020f1c8
3ffffeb0: 3ffee8b0 3ffe892d 3fff7554 402051eb
3ffffec0: 00000000 3fffff20 40206e2c 3fffefa0
3ffffed0: 00000000 00000000 00000000 402014df
3ffffee0: 00000d50 3fff777c 3fff7554 40204059
3ffffef0: 000001bb 3fff7554 3ffeeef4 3ffeef6c
3fffff00: 000001bb 3fff7554 3ffe892d 3ffeef6c
3fffff10: 000001bb 3fff7554 3ffe892d 402053fa
3fffff20: 402077a0 0e01d9ac 3ffeeef4 402063c0
3fffff30: 3ffeeebc 3ffe84e0 3ffeeef4 40202fc1
3fffff40: 3ffe85e2 3fff0514 3ffe892d 40206349
3fffff50: 3ffe876a 00000000 3ffeeef4 40206374
3fffff60: 402077a0 3ffeeebc 3ffeeef4 402063c0
3fffff70: 3ffe84e0 3ffeeebc 3ffeeef4 40202e2e
3fffff80: 402077a0 1400a8c0 feefeffe feefeffe
3fffff90: feefeffe feefeffe feefeffe 3ffeef6c
3fffffa0: 3fffdad0 00000000 3ffeef3c 40206ed8
3fffffb0: feefeffe feefeffe 3ffe8518 401009a5
<<<stack<<<

last failed alloc call: 4020F1F8(16709)

ets Jan 8 2013,rst cause:4, boot mode:(1,6)

wdt reset

@Alpol2019
Copy link

Alpol2019 commented Aug 3, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants