Skip to content

Commit d4207ec

Browse files
committed
[Travis] Changes needed due to update core 2.6.0 for File::write
1 parent d2190ca commit d4207ec

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/ESPEasy.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ void loop()
498498
if(MainLoopCall_ptr)
499499
MainLoopCall_ptr();
500500
*/
501+
dummyString = String(); // Fixme TD-er Make sure this global variable doesn't keep memory allocated.
501502

502503
updateLoopStats();
503504

src/ESPEasyStorage.ino

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ String appendLineToFile(const String& fname, const String& line) {
4646
SPIFFS_CHECK(f, fname.c_str());
4747
const size_t lineLength = line.length();
4848
for (size_t i = 0; i < lineLength; ++i) {
49-
SPIFFS_CHECK(f.write(line[i]), fname.c_str());
49+
// See https://github.com/esp8266/Arduino/commit/b1da9eda467cc935307d553692fdde2e670db258#r32622483
50+
uint8_t value = static_cast<uint8_t>(line[i]);
51+
SPIFFS_CHECK(f.write(&value, 1), fname.c_str());
5052
}
5153
f.close();
5254
return "";
@@ -71,7 +73,9 @@ String BuildFixes()
7173
{
7274
for (int x = 0; x < 4096; x++)
7375
{
74-
SPIFFS_CHECK(f.write(0), fname.c_str());
76+
// See https://github.com/esp8266/Arduino/commit/b1da9eda467cc935307d553692fdde2e670db258#r32622483
77+
uint8_t zero_value = 0;
78+
SPIFFS_CHECK(f.write(&zero_value, 1), fname.c_str());
7579
}
7680
f.close();
7781
}
@@ -621,7 +625,9 @@ String SaveToFile(char* fname, int index, byte* memAddress, int datasize)
621625
byte *pointerToByteToSave = memAddress;
622626
for (int x = 0; x < datasize ; x++)
623627
{
624-
SPIFFS_CHECK(f.write(*pointerToByteToSave), fname);
628+
// See https://github.com/esp8266/Arduino/commit/b1da9eda467cc935307d553692fdde2e670db258#r32622483
629+
uint8_t byteToSave = *pointerToByteToSave;
630+
SPIFFS_CHECK(f.write(&byteToSave, 1), fname);
625631
pointerToByteToSave++;
626632
if (x % 256 == 0) {
627633
// one page written, do some background tasks

src/_P002_ADC.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ boolean Plugin_002(byte function, struct EventStruct *event, String& string)
110110
{
111111
if (PCONFIG(0)) //Oversampling?
112112
{
113-
uint16_t currentValue = P002_performRead();
113+
uint16_t currentValue = P002_performRead(event);
114114
Plugin_002_OversamplingValue += currentValue;
115115
++Plugin_002_OversamplingCount;
116116
if (currentValue > Plugin_002_OversamplingMaxVal) {
@@ -165,7 +165,7 @@ float P002_getOutputValue(struct EventStruct *event, int16_t &raw_value) {
165165
float_value = sum / count;
166166
raw_value = static_cast<int16_t>(float_value);
167167
} else {
168-
raw_value = P002_performRead();
168+
raw_value = P002_performRead(event);
169169
float_value = static_cast<float>(raw_value);
170170
}
171171
if (PCONFIG(3)) //Calibration?
@@ -183,7 +183,7 @@ float P002_getOutputValue(struct EventStruct *event, int16_t &raw_value) {
183183
return float_value;
184184
}
185185

186-
uint16_t P002_performRead() {
186+
uint16_t P002_performRead(struct EventStruct *event) {
187187
uint16_t value = 0;
188188
#if defined(ESP8266)
189189
value = analogRead(A0);

0 commit comments

Comments
 (0)