Skip to content

Commit 7756427

Browse files
authored
Merge branch 'master' into WiFiOffAtBoot
2 parents b2a53b7 + 48e1ccb commit 7756427

File tree

185 files changed

+16309
-1401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+16309
-1401
lines changed

boards.txt

Lines changed: 140 additions & 0 deletions
Large diffs are not rendered by default.

bootloaders/eboot/eboot.elf

-44 Bytes
Binary file not shown.

cores/esp8266/Client.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
class Client: public Stream {
2727

2828
public:
29-
virtual int connect(IPAddress ip, uint16_t port) =0;
30-
virtual int connect(const char *host, uint16_t port) =0;
31-
virtual size_t write(uint8_t) =0;
32-
virtual size_t write(const uint8_t *buf, size_t size) =0;
33-
virtual int available() = 0;
34-
virtual int read() = 0;
35-
virtual int read(uint8_t *buf, size_t size) = 0;
36-
virtual int peek() = 0;
37-
virtual void flush() = 0;
29+
virtual int connect(IPAddress ip, uint16_t port) = 0;
30+
virtual int connect(const char *host, uint16_t port) = 0;
31+
virtual size_t write(uint8_t) override = 0;
32+
virtual size_t write(const uint8_t *buf, size_t size) override = 0;
33+
virtual int available() override = 0;
34+
virtual int read() override = 0;
35+
virtual int read(uint8_t *buf, size_t size) override = 0;
36+
virtual int peek() override = 0;
37+
virtual void flush() override = 0;
3838
virtual void stop() = 0;
3939
virtual uint8_t connected() = 0;
4040
virtual operator bool() = 0;

cores/esp8266/Esp.cpp

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
#include "coredecls.h"
3131
#include "umm_malloc/umm_malloc.h"
32-
// #include "core_esp8266_vm.h"
3332
#include <pgmspace.h>
3433
#include "reboot_uart_dwnld.h"
3534

@@ -984,22 +983,11 @@ String EspClass::getSketchMD5()
984983
return result;
985984
}
986985

987-
void EspClass::enableVM()
988-
{
989-
#ifdef UMM_HEAP_EXTERNAL
990-
if (!vmEnabled)
991-
install_vm_exception_handler();
992-
vmEnabled = true;
993-
#endif
994-
}
995-
996986
void EspClass::setExternalHeap()
997987
{
998988
#ifdef UMM_HEAP_EXTERNAL
999-
if (vmEnabled) {
1000-
if (!umm_push_heap(UMM_HEAP_EXTERNAL)) {
1001-
panic();
1002-
}
989+
if (!umm_push_heap(UMM_HEAP_EXTERNAL)) {
990+
panic();
1003991
}
1004992
#endif
1005993
}
@@ -1016,10 +1004,8 @@ void EspClass::setIramHeap()
10161004
void EspClass::setDramHeap()
10171005
{
10181006
#if defined(UMM_HEAP_EXTERNAL) && !defined(UMM_HEAP_IRAM)
1019-
if (vmEnabled) {
1020-
if (!umm_push_heap(UMM_HEAP_DRAM)) {
1021-
panic();
1022-
}
1007+
if (!umm_push_heap(UMM_HEAP_DRAM)) {
1008+
panic();
10231009
}
10241010
#elif defined(UMM_HEAP_IRAM)
10251011
if (!umm_push_heap(UMM_HEAP_DRAM)) {
@@ -1031,10 +1017,8 @@ void EspClass::setDramHeap()
10311017
void EspClass::resetHeap()
10321018
{
10331019
#if defined(UMM_HEAP_EXTERNAL) && !defined(UMM_HEAP_IRAM)
1034-
if (vmEnabled) {
1035-
if (!umm_pop_heap()) {
1036-
panic();
1037-
}
1020+
if (!umm_pop_heap()) {
1021+
panic();
10381022
}
10391023
#elif defined(UMM_HEAP_IRAM)
10401024
if (!umm_pop_heap()) {

cores/esp8266/Esp.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,6 @@ class EspClass {
221221
#else
222222
uint32_t getCycleCount();
223223
#endif // !defined(CORE_MOCK)
224-
/**
225-
* @brief Installs VM exception handler to support External memory (Experimental)
226-
*
227-
* @param none
228-
* @return none
229-
*/
230-
void enableVM();
231224
/**
232225
* @brief Push current Heap selection and set Heap selection to DRAM.
233226
*
@@ -258,9 +251,6 @@ class EspClass {
258251
*/
259252
void resetHeap();
260253
private:
261-
#ifdef UMM_HEAP_EXTERNAL
262-
bool vmEnabled = false;
263-
#endif
264254
/**
265255
* @brief Replaces @a byteCount bytes of a 4 byte block on flash
266256
*

cores/esp8266/FS.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int File::read() {
6666
return result;
6767
}
6868

69-
size_t File::read(uint8_t* buf, size_t size) {
69+
int File::read(uint8_t* buf, size_t size) {
7070
if (!_p)
7171
return 0;
7272

@@ -441,6 +441,13 @@ bool FS::rename(const String& pathFrom, const String& pathTo) {
441441
return rename(pathFrom.c_str(), pathTo.c_str());
442442
}
443443

444+
time_t FS::getCreationTime() {
445+
if (!_impl) {
446+
return 0;
447+
}
448+
return _impl->getCreationTime();
449+
}
450+
444451
void FS::setTimeCallback(time_t (*cb)(void)) {
445452
if (!_impl)
446453
return;

cores/esp8266/FS.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ class File : public Stream
6767
size_t readBytes(char *buffer, size_t length) override {
6868
return read((uint8_t*)buffer, length);
6969
}
70-
size_t read(uint8_t* buf, size_t size);
70+
int read(uint8_t* buf, size_t size) override;
7171
bool seek(uint32_t pos, SeekMode mode);
7272
bool seek(uint32_t pos) {
7373
return seek(pos, SeekSet);
7474
}
7575
size_t position() const;
7676
size_t size() const;
77+
virtual ssize_t streamRemaining() override { return (ssize_t)size() - (ssize_t)position(); }
7778
void close();
7879
operator bool() const;
7980
const char* name() const;
@@ -84,6 +85,7 @@ class File : public Stream
8485
bool isDirectory() const;
8586

8687
// Arduino "class SD" methods for compatibility
88+
//TODO use stream::send / check read(buf,size) result
8789
template<typename T> size_t write(T &src){
8890
uint8_t obuf[256];
8991
size_t doneLen = 0;
@@ -235,6 +237,8 @@ class FS
235237
bool gc();
236238
bool check();
237239

240+
time_t getCreationTime();
241+
238242
void setTimeCallback(time_t (*cb)(void));
239243

240244
friend class ::SDClass; // More of a frenemy, but SD needs internal implementation to get private FAT bits

cores/esp8266/FSImpl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class FileImpl {
3030
public:
3131
virtual ~FileImpl() { }
3232
virtual size_t write(const uint8_t *buf, size_t size) = 0;
33-
virtual size_t read(uint8_t* buf, size_t size) = 0;
33+
virtual int read(uint8_t* buf, size_t size) = 0;
3434
virtual void flush() = 0;
3535
virtual bool seek(uint32_t pos, SeekMode mode) = 0;
3636
virtual size_t position() const = 0;
@@ -115,6 +115,7 @@ class FSImpl {
115115
virtual bool rmdir(const char* path) = 0;
116116
virtual bool gc() { return true; } // May not be implemented in all file systems.
117117
virtual bool check() { return true; } // May not be implemented in all file systems.
118+
virtual time_t getCreationTime() { return 0; } // May not be implemented in all file systems.
118119

119120
// Filesystems *may* support a timestamp per-file, so allow the user to override with
120121
// their own callback for all files on this FS. The default implementation simply

cores/esp8266/FunctionalInterrupt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ typedef void (*voidFuncPtrArg)(void*);
1010
extern "C" void __attachInterruptFunctionalArg(uint8_t pin, voidFuncPtr userFunc, void*fp, int mode, bool functional);
1111

1212

13-
void ICACHE_RAM_ATTR interruptFunctional(void* arg)
13+
void IRAM_ATTR interruptFunctional(void* arg)
1414
{
1515
ArgStructure* localArg = (ArgStructure*)arg;
1616
if (localArg->functionInfo->reqScheduledFunction)

cores/esp8266/HardwareSerial.h

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,45 @@ class HardwareSerial: public Stream
135135
// return -1 when data is unvailable (arduino api)
136136
return uart_peek_char(_uart);
137137
}
138+
139+
virtual bool hasPeekBufferAPI () const override
140+
{
141+
return true;
142+
}
143+
144+
// return a pointer to available data buffer (size = available())
145+
// semantic forbids any kind of read() before calling peekConsume()
146+
const char* peekBuffer () override
147+
{
148+
return uart_peek_buffer(_uart);
149+
}
150+
151+
// return number of byte accessible by peekBuffer()
152+
size_t peekAvailable () override
153+
{
154+
return uart_peek_available(_uart);
155+
}
156+
157+
// consume bytes after use (see peekBuffer)
158+
void peekConsume (size_t consume) override
159+
{
160+
return uart_peek_consume(_uart, consume);
161+
}
162+
138163
int read(void) override
139164
{
140165
// return -1 when data is unvailable (arduino api)
141166
return uart_read_char(_uart);
142167
}
143168
// ::read(buffer, size): same as readBytes without timeout
144-
size_t read(char* buffer, size_t size)
169+
int read(char* buffer, size_t size)
145170
{
146171
return uart_read(_uart, buffer, size);
147172
}
173+
int read(uint8_t* buffer, size_t size) override
174+
{
175+
return uart_read(_uart, (char*)buffer, size);
176+
}
148177
size_t readBytes(char* buffer, size_t size) override;
149178
size_t readBytes(uint8_t* buffer, size_t size) override
150179
{

0 commit comments

Comments
 (0)