From faa82020453983a499f44a8a6323f745c2f86bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Fri, 15 Dec 2017 23:01:10 +0100 Subject: [PATCH] Added msm_size and sdk_size to mDNS txts --- code/espurna/mdns.ino | 10 ++++++++++ code/ota_flash.sh | 16 +++++++++++----- code/ota_list.sh | 12 +++++++++--- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/code/espurna/mdns.ino b/code/espurna/mdns.ino index e62d6ff2..4c185674 100644 --- a/code/espurna/mdns.ino +++ b/code/espurna/mdns.ino @@ -46,6 +46,16 @@ void mdnsSetup() { MDNS.addServiceTxt("arduino", "tcp", "app_name", APP_NAME); MDNS.addServiceTxt("arduino", "tcp", "app_version", APP_VERSION); MDNS.addServiceTxt("arduino", "tcp", "target_board", DEVICE_NAME); + { + char buffer[6]; + itoa(ESP.getFlashChipRealSize() / 1024, buffer, 10); + MDNS.addServiceTxt("arduino", "tcp", "mem_size", (const char *) buffer); + } + { + char buffer[6]; + itoa(ESP.getFlashChipSize() / 1024, buffer, 10); + MDNS.addServiceTxt("arduino", "tcp", "sdk_size", (const char *) buffer); + } _mdns_wifi_onSTA = WiFi.onStationModeGotIP([](WiFiEventStationModeGotIP ipInfo) { _mdnsStart(); diff --git a/code/ota_flash.sh b/code/ota_flash.sh index de5b22e7..be1a574e 100755 --- a/code/ota_flash.sh +++ b/code/ota_flash.sh @@ -22,14 +22,16 @@ echo_pad() { useAvahi() { echo_pad "#" 4 - echo_pad "HOSTNAME" 20 - echo_pad "IP" 20 + echo_pad "HOSTNAME" 25 + echo_pad "IP" 25 echo_pad "APP" 15 echo_pad "VERSION" 15 echo_pad "DEVICE" 30 + echo_pad "MEM_SIZE" 10 + echo_pad "SDK_SIZE" 10 echo - printf -v line '%*s\n' 104 + printf -v line '%*s\n' 134 echo ${line// /-} counter=0 @@ -52,16 +54,20 @@ useAvahi() { app_name=`echo $txt | sed -n "s/.*app_name=\([^\"]*\).*/\1/p"` app_version=`echo $txt | sed -n "s/.*app_version=\([^\"]*\).*/\1/p"` board=`echo $txt | sed -n "s/.*target_board=\([^\"]*\).*/\1/p"` + mem_size=`echo $txt | sed -n "s/.*mem_size=\([^\"]*\).*/\1/p"` + sdk_size=`echo $txt | sed -n "s/.*sdk_size=\([^\"]*\).*/\1/p"` echo -n "$ip;" >> $ip_file echo -n "$board;" >> $board_file echo_pad "$counter" 4 - echo_pad "$hostname" 20 - echo_pad "$ip" 20 + echo_pad "$hostname" 25 + echo_pad "http://$ip" 25 echo_pad "$app_name" 15 echo_pad "$app_version" 15 echo_pad "$board" 30 + echo_pad "$mem_size" 10 + echo_pad "$sdk_size" 10 echo diff --git a/code/ota_list.sh b/code/ota_list.sh index f83713f9..6a988db9 100755 --- a/code/ota_list.sh +++ b/code/ota_list.sh @@ -14,14 +14,16 @@ echo_pad() { useAvahi() { echo_pad "#" 4 - echo_pad "HOSTNAME" 20 + echo_pad "HOSTNAME" 25 echo_pad "IP" 25 echo_pad "APP" 15 echo_pad "VERSION" 15 echo_pad "DEVICE" 30 + echo_pad "MEM_SIZE" 10 + echo_pad "SDK_SIZE" 10 echo - printf -v line '%*s\n' 104 + printf -v line '%*s\n' 134 echo ${line// /-} counter=0 @@ -36,13 +38,17 @@ useAvahi() { app_name=`echo $txt | sed -n "s/.*app_name=\([^\"]*\).*/\1/p"` app_version=`echo $txt | sed -n "s/.*app_version=\([^\"]*\).*/\1/p"` board=`echo $txt | sed -n "s/.*target_board=\([^\"]*\).*/\1/p"` + mem_size=`echo $txt | sed -n "s/.*mem_size=\([^\"]*\).*/\1/p"` + sdk_size=`echo $txt | sed -n "s/.*sdk_size=\([^\"]*\).*/\1/p"` echo_pad "$counter" 4 - echo_pad "$hostname" 20 + echo_pad "$hostname" 25 echo_pad "http://$ip" 25 echo_pad "$app_name" 15 echo_pad "$app_version" 15 echo_pad "$board" 30 + echo_pad "$mem_size" 10 + echo_pad "$sdk_size" 10 echo done