Merge branch 'development' of https://github.com/arendst/Tasmota into development

This commit is contained in:
Theo Arends 2021-03-21 17:52:00 +01:00
commit 4294a22854
4 changed files with 38 additions and 6 deletions

View File

@ -18,9 +18,9 @@
| USE_WEBSEND_RESPONSE | - | - | - | - | - | - | - |
| USE_EMULATION_HUE | - | x | x | - | x | - | - |
| USE_EMULATION_WEMO | - | x | x | - | x | - | - |
| USE_DISCOVERY | - | - | x | x | - | - | x |
| USE_DISCOVERY | - | - | - | - | - | - | - |
| WEBSERVER_ADVERTISE | - | - | x | x | - | - | x |
| MQTT_HOST_DISCOVERY | - | - | x | x | - | - | x |
| MQTT_HOST_DISCOVERY | - | - | - | - | - | - | - |
| USE_TIMERS | - | x | x | x | x | x | x |
| USE_TIMERS_WEB | - | x | x | x | x | x | x |
| USE_SUNRISE | - | x | x | x | x | x | x |

View File

@ -163,8 +163,14 @@
* The default is to use the functions in the standard library.
**/
#ifdef USE_BERRY_PSRAM
extern void *special_malloc(uint32_t size);
extern void *special_realloc(void *ptr, size_t size);
#ifdef __cplusplus
extern "C" {
#endif
extern void *berry_malloc(uint32_t size);
extern void *berry_realloc(void *ptr, size_t size);
#ifdef __cplusplus
}
#endif
#define BE_EXPLICIT_MALLOC special_malloc
#define BE_EXPLICIT_REALLOC special_realloc
#else

View File

@ -317,7 +317,7 @@ extern "C" {
int32_t top = be_top(vm); // Get the number of arguments
if (top == 1 || (top == 2 && be_isint(vm, 2))) {
int32_t light_num = 0;
if (top > 0) {
if (top > 1) {
light_num = be_toint(vm, 2);
}
push_getlight(vm, light_num);

View File

@ -47,6 +47,32 @@ void checkBeTop(void) {
}
}
/*********************************************************************************************\
* Memory handler
* Use PSRAM if available
\*********************************************************************************************/
extern "C" {
void *berry_malloc(uint32_t size);
void *berry_realloc(void *ptr, size_t size);
#ifdef USE_BERRY_PSRAM
void *berry_malloc(uint32_t size) {
return special_malloc(size);
}
void *berry_realloc(void *ptr, size_t size) {
return special_realloc(ptr, size);
}
#else
void *berry_malloc(uint32_t size) {
return malloc(size);
}
void *berry_realloc(void *ptr, size_t size) {
return realloc(ptr, size);
}
#endif // USE_BERRY_PSRAM
}
/*********************************************************************************************\
* Handlers for Berry calls and async
*
@ -564,7 +590,7 @@ void HandleBerryConsoleRefresh(void)
if (svalue.length()) {
berry.log.reset(); // clear all previous logs
berry.repl_active = true; // start recording
AddLog_P(LOG_LEVEL_INFO, PSTR("BRY: received command %s"), svalue.c_str());
// AddLog_P(LOG_LEVEL_INFO, PSTR("BRY: received command %s"), svalue.c_str());
berry.log.addString(svalue.c_str(), nullptr, BERRY_CONSOLE_CMD_DELIMITER);
// Call berry