mirror of https://github.com/arendst/Tasmota.git
commit
d59cdf6cd9
|
@ -163,8 +163,14 @@
|
||||||
* The default is to use the functions in the standard library.
|
* The default is to use the functions in the standard library.
|
||||||
**/
|
**/
|
||||||
#ifdef USE_BERRY_PSRAM
|
#ifdef USE_BERRY_PSRAM
|
||||||
extern void *special_malloc(uint32_t size);
|
#ifdef __cplusplus
|
||||||
extern void *special_realloc(void *ptr, size_t size);
|
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_MALLOC special_malloc
|
||||||
#define BE_EXPLICIT_REALLOC special_realloc
|
#define BE_EXPLICIT_REALLOC special_realloc
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -317,7 +317,7 @@ extern "C" {
|
||||||
int32_t top = be_top(vm); // Get the number of arguments
|
int32_t top = be_top(vm); // Get the number of arguments
|
||||||
if (top == 1 || (top == 2 && be_isint(vm, 2))) {
|
if (top == 1 || (top == 2 && be_isint(vm, 2))) {
|
||||||
int32_t light_num = 0;
|
int32_t light_num = 0;
|
||||||
if (top > 0) {
|
if (top > 1) {
|
||||||
light_num = be_toint(vm, 2);
|
light_num = be_toint(vm, 2);
|
||||||
}
|
}
|
||||||
push_getlight(vm, light_num);
|
push_getlight(vm, light_num);
|
||||||
|
|
|
@ -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
|
* Handlers for Berry calls and async
|
||||||
*
|
*
|
||||||
|
@ -564,7 +590,7 @@ void HandleBerryConsoleRefresh(void)
|
||||||
if (svalue.length()) {
|
if (svalue.length()) {
|
||||||
berry.log.reset(); // clear all previous logs
|
berry.log.reset(); // clear all previous logs
|
||||||
berry.repl_active = true; // start recording
|
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);
|
berry.log.addString(svalue.c_str(), nullptr, BERRY_CONSOLE_CMD_DELIMITER);
|
||||||
|
|
||||||
// Call berry
|
// Call berry
|
||||||
|
|
Loading…
Reference in New Issue