Chat freely about anything...

User avatar
By Sirquil
#79584 I do not understand what is happening; I am using a function that has worked 100% of the time in another sketch. This function is not working in the new sketch "Hawk_GPS_Time.no."
There are many moving parts to this sketch; New sketch adds tipping rain gauge, GPS location and Time, and FTP, these functions were added by Haroon552.

Not sure if related, sketch is getting wdt reset:

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
vbb28d4a3
~ld

Example sketches run okay; do not believe it is a power issue, power supply is rated at 3 Amps and is well regulated.

Second issue is the topic of this post; text file download with no text, just a blank file with content size of file. If I use a standalone FTP sketch and Filezilla same file has readable text when downloaded.

Have no experience using debugging tools; if someone could take a look, it would be appreciated.

William
Attachments
One file downloaded from project; same file downloaded using Filezilla.
(1.08 KiB) Downloaded 169 times
Project file with issue/s.
(22.66 KiB) Downloaded 163 times
Last edited by Sirquil on Tue Jan 29, 2019 1:15 pm, edited 1 time in total.
User avatar
By Sirquil
#79744 martinayotte's function for reading file; downloads are very fast!

Code: Select allvoid readFile()
{

     //digitalWrite(online, HIGH);   //turn-on online LED indicator

     String filename = (const char *)&MyBuffer;

      File webFile = SPIFFS.open(filename, "r");

     if (!webFile)
     {
          Serial.println("File failed to open");
          Serial.println("\n");
     }
     else
     {
         
          int siz = webFile.size();
          //.setContentLength(str.length() + siz);
          //webserver.send(200, "text/plain", str);
          while (siz > 0)
          {
               size_t len = std::min((int)(sizeof(buf) - 1), siz);
               webFile.read((uint8_t *)buf, len);
               client.write((const char*)buf, len);
               siz -= len;
          }
          webFile.close();
     }

     error = 0;

     delayTime = 1000;

     MyBuffer[0] = '\0';

     //digitalWrite(online, LOW);   //turn-off online LED indicator

    listen();
   
}


Issue I am having is missing text from text file with know good file content, as verified with "Filezilla." I have the same issue on two different computers, both running Windows 10. Just does not make sense; My earlier sketch "NTP_Web_Interface_Data_Logger.ino" uses the same readFile function, I am able to download files from URL links and read the contents of downloaded file. This is true on both Windows 10 computers. Revised sketch "Debug_2Hawk_GPS_Time.ino" I am able to download from URL links; however, there is no content to any text file!
Attachments
Sketch with no issue from URL downloads using SdBrowse function. File downloaded has readable content.
(17.8 KiB) Downloaded 168 times
Sketch with blank URL downloads from SdBrowse function. Debug Serial.print statements removed.
(16.99 KiB) Downloaded 165 times
User avatar
By Sirquil
#79802 Now using Eclipse, Version 4.10 development environment; now have 32 errors, down from 368.

Requesting help with remaining errors. Example of resolution for each type of remaining error would be helpful.

Checked for missing pair'{}' and '()' for "not declared in this scope."

Interesting that the Arduino IDE compiles and executes the sketch; however, there are wdt resets.

William
Attachments
File from Eclise 4.10; that has the 32 errors listed in "Eclipse 32 errors.txt" attachment.
(74.65 KiB) Downloaded 326 times
File from Eclipse version 4.10. Target: Wemos D1 R2
(3.62 KiB) Downloaded 336 times
User avatar
By McChubby007
#79803
Sirquil wrote:Now using Eclipse, Version 4.10 development environment; now have 32 errors, down from 368.

Requesting help with remaining errors. Example of resolution for each type of remaining error would be helpful.

Checked for missing pair'{}' and '()' for "not declared in this scope."

Interesting that the Arduino IDE compiles and executes the sketch; however, there are wdt resets.

William

You are sure that your project is setup correctly in Eclipse? Have you created a small test project to validate this? The divide-and-conquer approach can help also : split the code into smaller parts (or comment out chunks) and then try compiling each part - obviously beyond a certain amount of errors the compiler can get somewhat confused in any case, so you should fix the errors in top down order.

Ensure all relevant .h files are included. Arduino IDE doesn't require this and so errors maybe due to that. Please don't ask which .h files are needed for which function.

The function calls where you have a list of candidates in the error message tell you what the problem is - check how you are calling these and see what argument types are wrong, simple as that. I don't see the need for a long-winded list of examples to solve your problems, and I have plenty else to do without spending hours on that!