From af32b3f5e58b4af00124ed6a8d8bf413e36561c0 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 12 May 2020 15:42:16 +0200 Subject: [PATCH] Add ESP32 configuration webcam --- platformio_tasmota_env32.ini | 2 +- tasmota/i18n.h | 2 ++ tasmota/support_command.ino | 6 ++++ tasmota/tasmota_configurations.h | 4 +++ tasmota/tasmota_configurations_ESP32.h | 40 ++++++++++++++++++++++++++ tasmota/xdrv_81_webcam.ino | 6 ++-- 6 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 tasmota/tasmota_configurations_ESP32.h diff --git a/platformio_tasmota_env32.ini b/platformio_tasmota_env32.ini index e7f321464..f4f99282c 100644 --- a/platformio_tasmota_env32.ini +++ b/platformio_tasmota_env32.ini @@ -21,7 +21,7 @@ build_flags = ${common32.build_flags} extends = env:tasmota32 board = esp32cam board_build.f_cpu = 240000000L -build_flags = ${common32.build_flags} -DUSE_WEBCAM +build_flags = ${common32.build_flags} -DFIRMWARE_WEBCAM [env:tasmota32-minimal] extends = env:tasmota32 diff --git a/tasmota/i18n.h b/tasmota/i18n.h index 0d00692be..089a9b55f 100644 --- a/tasmota/i18n.h +++ b/tasmota/i18n.h @@ -123,6 +123,8 @@ #define D_JSON_PROBETEMPERATURE "ProbeTemperature" #define D_JSON_PROGRAMFLASHSIZE "ProgramFlashSize" #define D_JSON_PROGRAMSIZE "ProgramSize" +#define D_JSON_PSRMAXMEMORY "PsrMax" +#define D_JSON_PSRFREEMEMORY "PsrFree" #define D_JSON_REFERENCETEMPERATURE "ReferenceTemperature" #define D_JSON_REMAINING "Remaining" #define D_JSON_RESET "Reset" diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 1bd243754..cee21783e 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -461,6 +461,9 @@ void CmndStatus(void) if ((0 == payload) || (4 == payload)) { Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS4_MEMORY "\":{\"" D_JSON_PROGRAMSIZE "\":%d,\"" D_JSON_FREEMEMORY "\":%d,\"" D_JSON_HEAPSIZE "\":%d,\"" +#ifdef ESP32 + D_JSON_PSRMAXMEMORY "\":%d,\"" D_JSON_PSRFREEMEMORY "\":%d," +#endif D_JSON_PROGRAMFLASHSIZE "\":%d,\"" D_JSON_FLASHSIZE "\":%d" #ifdef ESP8266 ",\"" D_JSON_FLASHCHIPID "\":\"%06X\"" @@ -468,6 +471,9 @@ void CmndStatus(void) ",\"" D_JSON_FLASHMODE "\":%d,\"" D_JSON_FEATURES "\":[\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\"]"), ESP_getSketchSize()/1024, ESP.getFreeSketchSpace()/1024, ESP_getFreeHeap()/1024, +#ifdef ESP32 + ESP.getPsramSize()/1024, ESP.getFreePsram()/1024, +#endif ESP.getFlashChipSize()/1024, ESP.getFlashChipRealSize()/1024 #ifdef ESP8266 , ESP.getFlashChipId() diff --git a/tasmota/tasmota_configurations.h b/tasmota/tasmota_configurations.h index f0444efbb..37ac20237 100644 --- a/tasmota/tasmota_configurations.h +++ b/tasmota/tasmota_configurations.h @@ -638,4 +638,8 @@ #undef USE_DEBUG_DRIVER // Disable debug code #endif // FIRMWARE_MINIMAL +#ifdef ESP32 +#include "tasmota_configurations_ESP32.h" +#endif // ESP32 + #endif // _TASMOTA_CONFIGURATIONS_H_ diff --git a/tasmota/tasmota_configurations_ESP32.h b/tasmota/tasmota_configurations_ESP32.h new file mode 100644 index 000000000..b551c78ef --- /dev/null +++ b/tasmota/tasmota_configurations_ESP32.h @@ -0,0 +1,40 @@ +/* + tasmota_configurations_ESP32.h - ESP32 only Configurations for Tasmota + + Copyright (C) 2020 Theo Arends + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _TASMOTA_CONFIGURATIONS_ESP32_H_ +#define _TASMOTA_CONFIGURATIONS_ESP32_H_ + +#ifdef ESP32 + +/*********************************************************************************************\ + * [tasmota32-webcam.bin] + * Provide an image with useful supported sensors enabled +\*********************************************************************************************/ + +#ifdef FIRMWARE_WEBCAM + +#undef CODE_IMAGE_STR +#define CODE_IMAGE_STR "webcam" + +#define USE_WEBCAM +#endif // FIRMWARE_WEBCAM + +#endif // ESP32 + +#endif // _TASMOTA_CONFIGURATIONS_ESP32_H_ diff --git a/tasmota/xdrv_81_webcam.ino b/tasmota/xdrv_81_webcam.ino index efc5fa32c..fb2c86161 100644 --- a/tasmota/xdrv_81_webcam.ino +++ b/tasmota/xdrv_81_webcam.ino @@ -642,13 +642,13 @@ void HandleImage(void) { } client.stop(); - AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Sending image #: %d"), bnum+1); + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("CAM: Sending image #: %d"), bnum+1); } void HandleImageBasic(void) { if (!HttpCheckPriviledgedAccess()) { return; } - AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP "Capture image")); + AddLog_P(LOG_LEVEL_DEBUG_MORE, PSTR(D_LOG_HTTP "Capture image")); if (Settings.webcam_config.stream) { if (!CamServer) { @@ -686,7 +686,7 @@ void HandleImageBasic(void) { esp_camera_fb_return(wc_fb); // Free frame buffer - AddLog_P2(LOG_LEVEL_DEBUG, PSTR("CAM: Image sent")); + AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("CAM: Image sent")); } void HandleWebcamMjpeg(void) {