-->
Page 1 of 3

Text files download blank, with no text --solved.

PostPosted: Sat Dec 15, 2018 6:39 pm
by Sirquil
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

Re: Text files download blank, with no text.

PostPosted: Thu Dec 27, 2018 9:14 pm
by Sirquil
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!

Re: Text files download blank, with no text.

PostPosted: Tue Jan 01, 2019 11:49 am
by Sirquil
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

Re: Text files download blank, with no text.

PostPosted: Tue Jan 01, 2019 1:57 pm
by McChubby007
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!