File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -482,10 +482,23 @@ IPAddress networkGetSubnetMask(uint8_t networkType)
482482// ----------------------------------------
483483uint8_t networkGetActiveType ()
484484{
485- NETWORK_DATA *network;
486- uint8_t type;
485+ // Previously we had this (which is wrong - network is not initialized):
486+ // NETWORK_DATA *network;
487+ // uint8_t type;
488+ // type = network->type;
489+
490+ // Is the intent this?
491+ // NETWORK_DATA *network;
492+ // uint8_t type;
493+ // network = &networkData;
494+ // type = network->type;
495+
496+ // Or this?
497+ uint8_t type = networkGetType ();
498+
499+ if (settings.debugNetworkLayer )
500+ systemPrintf (" networkGetActiveType: network type is %s\r\n " , networkTypeToString (type));
487501
488- type = network->type ;
489502 if (type == NETWORK_TYPE_USE_DEFAULT)
490503 type = NETWORK_TYPE_ETHERNET;
491504 return type;
@@ -1063,8 +1076,13 @@ uint8_t networkTranslateNetworkType(uint8_t networkType, bool translateActive)
10631076// ----------------------------------------
10641077const char *networkTypeToString (uint8_t type)
10651078{
1079+ static const char unknown[] = { " Unknown" };
10661080 if (type >= networkNameEntries)
1067- return " Unknown" ;
1081+ {
1082+ if (settings.debugNetworkLayer )
1083+ systemPrintf (" networkTypeToString: unknown type %d" , type);
1084+ return unknown;
1085+ }
10681086 return networkName[type];
10691087}
10701088
You can’t perform that action at this time.
0 commit comments