Skip to content

Commit

Permalink
[Travis] Changes needed due to update core 2.6.0 for File::write
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-er committed Mar 6, 2019
1 parent d2190ca commit d4207ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/ESPEasy.ino
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ void loop()
if(MainLoopCall_ptr)
MainLoopCall_ptr();
*/
dummyString = String(); // Fixme TD-er Make sure this global variable doesn't keep memory allocated.

updateLoopStats();

Expand Down
12 changes: 9 additions & 3 deletions src/ESPEasyStorage.ino
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ String appendLineToFile(const String& fname, const String& line) {
SPIFFS_CHECK(f, fname.c_str());
const size_t lineLength = line.length();
for (size_t i = 0; i < lineLength; ++i) {
SPIFFS_CHECK(f.write(line[i]), fname.c_str());
// See https://github.com/esp8266/Arduino/commit/b1da9eda467cc935307d553692fdde2e670db258#r32622483
uint8_t value = static_cast<uint8_t>(line[i]);
SPIFFS_CHECK(f.write(&value, 1), fname.c_str());
}
f.close();
return "";
Expand All @@ -71,7 +73,9 @@ String BuildFixes()
{
for (int x = 0; x < 4096; x++)
{
SPIFFS_CHECK(f.write(0), fname.c_str());
// See https://github.com/esp8266/Arduino/commit/b1da9eda467cc935307d553692fdde2e670db258#r32622483
uint8_t zero_value = 0;
SPIFFS_CHECK(f.write(&zero_value, 1), fname.c_str());
}
f.close();
}
Expand Down Expand Up @@ -621,7 +625,9 @@ String SaveToFile(char* fname, int index, byte* memAddress, int datasize)
byte *pointerToByteToSave = memAddress;
for (int x = 0; x < datasize ; x++)
{
SPIFFS_CHECK(f.write(*pointerToByteToSave), fname);
// See https://github.com/esp8266/Arduino/commit/b1da9eda467cc935307d553692fdde2e670db258#r32622483
uint8_t byteToSave = *pointerToByteToSave;
SPIFFS_CHECK(f.write(&byteToSave, 1), fname);
pointerToByteToSave++;
if (x % 256 == 0) {
// one page written, do some background tasks
Expand Down
6 changes: 3 additions & 3 deletions src/_P002_ADC.ino
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ boolean Plugin_002(byte function, struct EventStruct *event, String& string)
{
if (PCONFIG(0)) //Oversampling?
{
uint16_t currentValue = P002_performRead();
uint16_t currentValue = P002_performRead(event);
Plugin_002_OversamplingValue += currentValue;
++Plugin_002_OversamplingCount;
if (currentValue > Plugin_002_OversamplingMaxVal) {
Expand Down Expand Up @@ -165,7 +165,7 @@ float P002_getOutputValue(struct EventStruct *event, int16_t &raw_value) {
float_value = sum / count;
raw_value = static_cast<int16_t>(float_value);
} else {
raw_value = P002_performRead();
raw_value = P002_performRead(event);
float_value = static_cast<float>(raw_value);
}
if (PCONFIG(3)) //Calibration?
Expand All @@ -183,7 +183,7 @@ float P002_getOutputValue(struct EventStruct *event, int16_t &raw_value) {
return float_value;
}

uint16_t P002_performRead() {
uint16_t P002_performRead(struct EventStruct *event) {
uint16_t value = 0;
#if defined(ESP8266)
value = analogRead(A0);
Expand Down

0 comments on commit d4207ec

Please sign in to comment.