diff --git a/CMakeLists.txt b/CMakeLists.txt index 73fbe2db..3c26e550 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,9 +22,9 @@ OPTION(ESP32S3_CUSTOM "HARDWARE TARGET is ESP32S3 custom board" OFF) OPTION(ESP32_CUSTOM "HARDWARE TARGET is ESP32 custom board" OFF) -# ####################################### +# =========================================== # Optionally: Select hardware mods applied -# ####################################### +# =========================================== #only for ESP32S3_8048S070C OR ESP32S3_8048S050C OR ESP32S3_8048S043C OR ESP32S3_4827S043C OR ESP32_3248S035C OPTION(HARDWARE_MOD_GT911_INT "Hardware Mod: GT911 INT pin" OFF) @@ -36,18 +36,18 @@ OPTION(HARDWARE_MOD_EXT_PSRAM "Hardware Mod: External PSRAM" OFF) -# ####################################### +# =========================================== # Select one targeted firmware -# ####################################### -OPTION(TARGET_FW_MARLIN "Marlin firmware" OFF) +# =========================================== +OPTION(TARGET_FW_MARLIN "Marlin firmware" ON) OPTION(TARGET_FW_REPETIER "Repetier firmware" OFF) OPTION(TARGET_FW_SMOOTHIEWARE "Smoothieware firmware" OFF) -OPTION(TARGET_FW_GRBL "GRBL firmware" ON) +OPTION(TARGET_FW_GRBL "GRBL firmware"OFF) -# ####################################### +# =========================================== # Select the Features -# ####################################### +# =========================================== OPTION(ESP3D_AUTHENTICATION "Authentication on all clients" OFF) OPTION(DISABLE_SERIAL_AUTHENTICATION "Disable Serial Authentication" ON) OPTION(TIME_SERVICE "Time service" ON) @@ -67,9 +67,9 @@ OPTION(UPDATE_SERVICE "Update service" ON) OPTION(USB_SERIAL_SERVICE "Use USB Serial if Available" ON) OPTION(USE_FAT_INSTEAD_OF_LITTLEFS "Use FAT instead of LittleFS" OFF) -# ####################################### -# Do not change anything below this line -# ####################################### +# =========================================== +# Internal Configuration (Do Not Modify) +# =========================================== set(PLATFORMS_LIST ESP32S3_HMI43V3 diff --git a/cmake/dev_tools.cmake b/cmake/dev_tools.cmake index e1b86db2..0d7c9d7f 100644 --- a/cmake/dev_tools.cmake +++ b/cmake/dev_tools.cmake @@ -1,16 +1,47 @@ -# ESP3D-TFT specific log level -# All = 3 -# Debug = 2 -# Error only = 1 -# Disabled = 0 -add_compile_options(-DESP3D_TFT_LOG=1) -# Disable ANSI color to fit some serial terminals -add_compile_options(-DDISABLE_COLOR_LOG=0) - -#Use the Snapshot API of LVGL to dump screens to the SD card -add_compile_options(-DLV_USE_SNAPSHOT=1) - -# ESP3D-TFT specific bechmark -# Enabled = 1 -# Disabled = 0 -add_compile_options(-DESP3D_TFT_BENCHMARK=0) \ No newline at end of file +# ESP3D-TFT Development Configuration + +# =========================================== +# Logging Configuration +# =========================================== + +# ESP3D-TFT Log Level +# 3 = All +# 2 = Debug +# 1 = Error only +# 0 = Disabled +set(ESP3D_TFT_LOG_LEVEL 0) +add_compile_options(-DESP3D_TFT_LOG=${ESP3D_TFT_LOG_LEVEL}) + +# ANSI Color in Logs +# 0 = Enabled (default) +# 1 = Disabled (for compatibility with some serial terminals) +set(DISABLE_COLOR_LOG 0) +add_compile_options(-DDISABLE_COLOR_LOG=${DISABLE_COLOR_LOG}) + +# =========================================== +# LVGL Configuration +# =========================================== + +# Use the Snapshot API of LVGL to dump screens to the SD card +set(LV_USE_SNAPSHOT 0) +add_compile_options(-DLV_USE_SNAPSHOT=${LV_USE_SNAPSHOT}) + +# =========================================== +# Telnet Configuration +# =========================================== +# Disable telnet server welcome message for compatibility with some serial terminals +# 1 = Disable telnet server welcome message +# 0 = Keep telnet server welcome message + +set(DISABLE_TELNET_WELCOME_MESSAGE 0) +add_compile_options(-DDISABLE_TELNET_WELCOME_MESSAGE=${DISABLE_TELNET_WELCOME_MESSAGE}) + +# =========================================== +# Performance Configuration +# =========================================== + +# ESP3D-TFT Benchmark +# 1 = Enabled +# 0 = Disabled +set(ESP3D_TFT_BENCHMARK 0) +add_compile_options(-DESP3D_TFT_BENCHMARK=${ESP3D_TFT_BENCHMARK}) diff --git a/cmake/features.cmake b/cmake/features.cmake index 115d24a1..2486e084 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -1,6 +1,8 @@ - # DO NOT EDIT THIS FILE -# Firmware target + +# =========================================== +# Firmware target configuration +# =========================================== if(TARGET_FW_MARLIN) add_compile_options(-DTARGET_IS_MARLIN=1) if(TFT_UI_SERVICE) @@ -8,35 +10,41 @@ if(TARGET_FW_MARLIN) endif() add_compile_options("-I${CMAKE_SOURCE_DIR}/main/target/3dprinter/marlin") elseif(TARGET_FW_REPETIER) - add_compile_options(-DTARGET_IS_REPETIER=1) - if(TFT_UI_SERVICE) + add_compile_options(-DTARGET_IS_REPETIER=1) + if(TFT_UI_SERVICE) add_compile_options("-I${CMAKE_SOURCE_DIR}/main/display/3dprinter/repetier") endif() add_compile_options("-I${CMAKE_SOURCE_DIR}/main/target/3dprinter/repetier") elseif(TARGET_FW_SMOOTHIEWARE) - add_compile_options(-DTARGET_IS_SMOOTHIEWARE=1) - if(TFT_UI_SERVICE) + add_compile_options(-DTARGET_IS_SMOOTHIEWARE=1) + if(TFT_UI_SERVICE) add_compile_options("-I${CMAKE_SOURCE_DIR}/main/display/3dprinter/smoothieware") endif() add_compile_options("-I${CMAKE_SOURCE_DIR}/main/target/3dprinter/smoothieware") elseif(TARGET_FW_GRBL) - add_compile_options(-DTARGET_IS_GRBL=1) - if(TFT_UI_SERVICE) + add_compile_options(-DTARGET_IS_GRBL=1) + if(TFT_UI_SERVICE) add_compile_options("-I${CMAKE_SOURCE_DIR}/main/display/cnc/grbl") endif() add_compile_options("-I${CMAKE_SOURCE_DIR}/main/target/cnc/grbl") endif() -# Add the dev tools settings +# =========================================== +# Development tools +# =========================================== include(cmake/dev_tools.cmake) -# Features +# =========================================== +# Core Features +# =========================================== +# File system selection if(USE_FAT_INSTEAD_OF_LITTLEFS) add_compile_options(-DESP3D_FATFS_FEATURE=1) else() add_compile_options(-DESP3D_LITTLEFS_FEATURE=1) endif() +# Authentication if(ESP3D_AUTHENTICATION) add_compile_options(-DESP3D_AUTHENTICATION_FEATURE=1) endif() @@ -45,10 +53,14 @@ if(DISABLE_SERIAL_AUTHENTICATION) add_compile_options(-DESP3D_DISABLE_SERIAL_AUTHENTICATION_FEATURE=1) endif() +# Time service if(TIME_SERVICE) add_compile_options(-DESP3D_TIMESTAMP_FEATURE=1) endif() +# =========================================== +# Network Services +# =========================================== if(WIFI_SERVICE) add_compile_options(-DESP3D_WIFI_FEATURE=1) @@ -86,39 +98,104 @@ if(BT_SERVICE) add_compile_options(-DESP3D_BLUETOOTH_FEATURE=1) endif() +# =========================================== +# User Interface +# =========================================== if(TFT_UI_SERVICE) add_compile_options(-DESP3D_DISPLAY_FEATURE=1) # For lvgl_conf to use simple path add_compile_options(-DLV_CONF_INCLUDE_SIMPLE=1) add_compile_options(-DLV_LVGL_H_INCLUDE_SIMPLE=1) add_compile_options("-I${CMAKE_SOURCE_DIR}/main/display") - else() +else() add_compile_options(-DLV_CONF_SUPPRESS_DEFINE_CHECK=1) endif() +# =========================================== +# Storage and Updates +# =========================================== if(SD_CARD_SERVICE) add_compile_options(-DESP3D_SD_CARD_FEATURE=1) if(UPDATE_SERVICE) add_compile_options(-DESP3D_UPDATE_FEATURE=1) endif() else() -unset(UPDATE_SERVICE CACHE) + unset(UPDATE_SERVICE CACHE) endif() - -# Add entry point for customizations headers +# =========================================== +# Customizations +# =========================================== add_compile_options("-I${CMAKE_SOURCE_DIR}/customizations") - add_compile_options(-DTFT_TARGET="${TFT_TARGET}") -# check the configuration -include (cmake/sanity_check.cmake) +# =========================================== +# Configuration Check +# =========================================== +include(cmake/sanity_check.cmake) + +# =========================================== +# Configuration Summary +# =========================================== +# =========================================== +# Final Configuration Summary +# =========================================== + +message(STATUS "") +message(STATUS "${BoldCyan}Configuration Summary:${ColourReset}") +message(STATUS "${Cyan}------------------------${ColourReset}") +message(STATUS "${Cyan}PROJECT_NAME: ${White}ESP3D TFT${ColourReset}") +message(STATUS "${Cyan}Hardware Target: ${White}${board_target}${ColourReset}") +message(STATUS "${Cyan}Firmware Target: ${White}${fw_target}${ColourReset}") +message(STATUS "${Cyan}Platform: ${White}${IDF_TARGET}${ColourReset}") +message(STATUS "${Cyan}WiFi: ${White}${WIFI_SERVICE} ${ColourReset}") +message(STATUS "${Cyan}Bluetooth: ${White}${BT_SERVICE} ${ColourReset}") +message(STATUS "${Cyan}TFT UI: ${White}${TFT_UI_SERVICE} ${ColourReset}") +message(STATUS "${Cyan}SD Card: ${White}${SD_CARD_SERVICE} ${ColourReset}") +message(STATUS "${Cyan}Update Service: ${White}${UPDATE_SERVICE} ${ColourReset}") +message(STATUS "${Cyan}Use FAT instead of LittleFS: ${White}${USE_FAT_INSTEAD_OF_LITTLEFS} ${ColourReset}") +message(STATUS "${Cyan}Authentication: ${White}${ESP3D_AUTHENTICATION} ${ColourReset}") +message(STATUS "${Cyan}Time Service: ${White}${TIME_SERVICE} ${ColourReset}") +message(STATUS "${Cyan}------------------------${ColourReset}") +message(STATUS "") + + +# =========================================== +# Development Configuration Summary +# =========================================== +if(ESP3D_TFT_LOG_LEVEL EQUAL 0) + set(TFT_LOG_LEVEL_STATUS "Disabled") +else() + set(TFT_LOG_LEVEL_STATUS "${ESP3D_TFT_LOG_LEVEL}") +endif() +if (DISABLE_COLOR_LOG EQUAL 1) + set(TFT_LOG_COLOR_STATUS "Disabled") +else() + set(TFT_LOG_COLOR_STATUS "Enabled") +endif() +if (LV_USE_SNAPSHOT EQUAL 1) + set(TFT_LVGL_SNAPSHOT_STATUS "Enabled") +else() + set(TFT_LVGL_SNAPSHOT_STATUS "Disabled") +endif() +if (ESP3D_TFT_BENCHMARK EQUAL 1) + set(TFT_BENCHMARK_STATUS "Enabled") +else() + set(TFT_BENCHMARK_STATUS "Disabled") +endif() +if (DISABLE_TELNET_WELCOME_MESSAGE EQUAL 1) + set(TFT_TELNET_WELCOME_MESSAGE_STATUS "Disabled") +else() + set(TFT_TELNET_WELCOME_MESSAGE_STATUS "Enabled") +endif() -# Status message(STATUS "") -message(STATUS "----Project definition----") -message(STATUS "PROJECT_NAME = ESP3D TFT") -message(STATUS "TFT_TARGET = ${TFT_TARGET}") -message(STATUS "IDF_TARGET = ${IDF_TARGET}") -message(STATUS "--------------------------") -message(STATUS "") \ No newline at end of file +message(STATUS "${BoldCyan}Development Configuration Summary:${ColourReset}") +message(STATUS "${Cyan}------------------------${ColourReset}") +message(STATUS "${Cyan}Log Level: ${White}${TFT_LOG_LEVEL_STATUS}${ColourReset}") +message(STATUS "${Cyan}ANSI Color in Logs: ${White}${TFT_LOG_COLOR_STATUS}${ColourReset}") +message(STATUS "${Cyan}LVGL Snapshot: ${White}${TFT_LVGL_SNAPSHOT_STATUS}${ColourReset}") +message(STATUS "${Cyan}Benchmark: ${White}${TFT_BENCHMARK_STATUS}${ColourReset}") +message(STATUS "${Cyan}Telnet Welcome Message: ${White}${TFT_TELNET_WELCOME_MESSAGE_STATUS}${ColourReset}") +message(STATUS "${Cyan}------------------------${ColourReset}") +message(STATUS "") diff --git a/cmake/sanity_check.cmake b/cmake/sanity_check.cmake index ea5857d9..6d5de251 100644 --- a/cmake/sanity_check.cmake +++ b/cmake/sanity_check.cmake @@ -1,66 +1,83 @@ - # DO NOT EDIT THIS FILE -#Check Target Firmware -if (NOT(TARGET_FW_MARLIN OR TARGET_FW_REPETIER OR TARGET_FW_SMOOTHIEWARE OR TARGET_FW_GRBL)) - message(FATAL_ERROR - "\n" - "No firmware target defined, please define a target in CMakeLists.txt" - "\n" - "Now cmake will exit") -endif() -#Check Target Board -if (NOT (TFT_TARGET)) - message(FATAL_ERROR - "\n" - "No hardware target defined, please define a target in CMakeLists.txt" - "\n" - "Now cmake will exit") -endif() +# =========================================== +# Color Definitions +# =========================================== + + + string(ASCII 27 Esc) + set(ColourReset "${Esc}[m") + set(ColourBold "${Esc}[1m") + set(Red "${Esc}[31m") + set(Green "${Esc}[32m") + set(Yellow "${Esc}[33m") + set(Blue "${Esc}[34m") + set(Magenta "${Esc}[35m") + set(Cyan "${Esc}[36m") + set(White "${Esc}[37m") + set(BoldRed "${Esc}[1;31m") + set(BoldGreen "${Esc}[1;32m") + set(BoldYellow "${Esc}[1;33m") + set(BoldBlue "${Esc}[1;34m") + set(BoldMagenta "${Esc}[1;35m") + set(BoldCyan "${Esc}[1;36m") + set(BoldWhite "${Esc}[1;37m") -#Check only one platform is selected -unset (system_selected) -foreach(platform_enabled ${PLATFORMS_LIST}) - if(${platform_enabled}) - if (system_selected) - # Display the selected platforms - foreach(platforms_option ${PLATFORMS_LIST}) - if(${platforms_option}) - message(STATUS "Platform ${platforms_option} enabled") +# =========================================== +# Helper Functions +# =========================================== + +function(check_single_selection var_list error_message selected_item) + set(selected_count 0) + set(last_selected "") + foreach(item ${${var_list}}) + if(${item}) + math(EXPR selected_count "${selected_count} + 1") + set(last_selected ${item}) endif() endforeach() - message(FATAL_ERROR - "\n" - "Multiple platforms selected, please select only one platform in CMakeLists.txt" - "\n" - "Now cmake will exit") + + if(selected_count EQUAL 0) + message(FATAL_ERROR "\n${BoldRed}No ${error_message} selected. Please select one in CMakeLists.txt${ColourReset}\n") + elseif(selected_count GREATER 1) + message(STATUS "\n\n${BoldRed}Multiple ${error_message}s selected:${ColourReset}") + foreach(item ${${var_list}}) + if(${item}) + message(STATUS " ${BoldRed}${item}${ColourReset}") + endif() + endforeach() + message(STATUS "\n") + message(FATAL_ERROR "\n${BoldRed}Please select only one ${error_message} in CMakeLists.txt${ColourReset}\n") else() - set(system_selected ${platform_enabled}) + message(STATUS "${Green}Selected ${error_message}: ${last_selected}${ColourReset}\n") + set(${selected_item} ${last_selected} PARENT_SCOPE) endif() - endif() -endforeach() +endfunction() +# =========================================== +# Firmware Target Check +# =========================================== -#check if multiple Fw targets are selected -unset (fw_selected) +set (fw_target "") +check_single_selection(FIRMWARES_LIST "firmware target" fw_target) -foreach(fw_enabled ${FIRMWARES_LIST}) - if(${fw_enabled}) - if (fw_selected) - # Display the selected platforms - foreach(fw_option ${FIRMWARES_LIST}) - if(${fw_option}) - message(STATUS "Firmware ${fw_option} enabled") - endif() - endforeach() - message(FATAL_ERROR +# =========================================== +# Target Board Check +# =========================================== + +if(NOT TFT_TARGET) + message(FATAL_ERROR "\n" - "Multiple firmwares selected, please select only one firmware in CMakeLists.txt" + "${BoldRed}No hardware target defined. Please define a target in CMakeLists.txt${ColourReset}" "\n" - "Now cmake will exit") - else() - set(fw_selected ${fw_enabled}) - endif() - endif() -endforeach() + "Now cmake will exit\n") +endif() + + +# =========================================== +# Platform Check +# =========================================== +set (board_target "") +check_single_selection(PLATFORMS_LIST "platform" board_target) + diff --git a/main/core/includes/esp3d_version.h b/main/core/includes/esp3d_version.h index 8b56a5bb..79c8dd07 100644 --- a/main/core/includes/esp3d_version.h +++ b/main/core/includes/esp3d_version.h @@ -23,7 +23,7 @@ #ifdef __cplusplus extern "C" { #endif -#define ESP3D_TFT_VERSION "1.0.0.a23" +#define ESP3D_TFT_VERSION "1.0.0.a24" #define ESP3D_TFT_FW_URL "https://github.com/luc-github/ESP3D-TFT" #ifdef __cplusplus diff --git a/main/modules/socket_server/esp3d_socket_server.cpp b/main/modules/socket_server/esp3d_socket_server.cpp index a496ee85..734dec3f 100644 --- a/main/modules/socket_server/esp3d_socket_server.cpp +++ b/main/modules/socket_server/esp3d_socket_server.cpp @@ -294,7 +294,9 @@ bool ESP3DSocketServer::getClient() { sizeof(addr_str) - 1); esp3d_log("Socket accepted ip address: %s", addr_str); #endif +#if !DISABLE_TELNET_WELCOME_MESSAGE sendToSocket(sock, WELCOME_MSG, strlen(WELCOME_MSG)); +#endif // DISABLE_TELNET_WELCOME_MESSAGE return true; }