CTBot icon indicating copy to clipboard operation
CTBot copied to clipboard

Add serial info to new IP on ver 2.1.14

Open bosoft-ESP opened this issue 3 years ago • 2 comments

Hello I have been thinking about adding these lines in the CTBotWifiSetup.cpp file to report the IP change in the CTBotWifiSetup::setIP function.

Following the same rules as in the line 111-113 in function CTBotWifiSetup::wifiConnect

if` (WiFi.status() == WL_CONNECTED) {
		IPAddress ip = WiFi.localIP();
		message = (String)FSTR("\nWiFi connected IPAddress: ") + ip.toString() + (String)"\n";
		serialLog(message, CTBOT_DEBUG_WIFI);

I have inserted the same to line 71-73 in function CTBotWifiSetup::setIP

	if (WiFi.config(IP, GW, SN, DNS1, DNS2)){
		IPAddress ip = WiFi.localIP();
		String message = (String)FSTR("New IP address: ") + ip.toString() + (String)"\n";
		serialLog(message, CTBOT_DEBUG_WIFI);

Although it would be better if these lines were like this:

		#ifdef CTBOT_DEBUG_DISABLED == 1
		IPAddress ip = WiFi.localIP();
		String message = (String)FSTR("New IP address: ") + ip.toString() + (String)"\n";
		serialLog(message, CTBOT_DEBUG_WIFI);
		#endif

this way it would not compile if CTBOT_DEBUG_DISABLED == 0

Thanks for your hard work. Regards

bosoft-ESP avatar Mar 07 '21 09:03 bosoft-ESP

Hello bosoft-ESP, I added the functionality you asked for in the v 2.1.5 (with others patches) and a new release is on the way. Thanks fo using the library!

Cheers

Stefano

shurillu avatar Mar 09 '21 13:03 shurillu

Thanks to you for your great work Best regards

bosoft-ESP avatar Mar 09 '21 16:03 bosoft-ESP