set IP from DHCP into Ethernet module, IP works!

This commit is contained in:
2020-11-09 20:10:12 +01:00
parent 25c0b74552
commit b64e9b5a73

View File

@ -63,7 +63,18 @@ static void wizReset(bool b) {
static void wizDHCPAssign() {
coloredMsg(LOG_RED, "wizda");
coloredMsg(LOG_GREEN, "wizda");
getIPfromDHCP(netInfo.ip);
coloredMsg(LOG_GREEN, "wizda, IP: %d.%d.%d.%d", netInfo.ip[0], netInfo.ip[1], netInfo.ip[2], netInfo.ip[3]);
getGWfromDHCP(netInfo.gw);
coloredMsg(LOG_GREEN, "wizda, GW: %d.%d.%d.%d", netInfo.gw[0], netInfo.gw[1], netInfo.gw[2], netInfo.gw[3]);
getSNfromDHCP(netInfo.sn);
coloredMsg(LOG_GREEN, "wizda, SN: %d.%d.%d.%d", netInfo.sn[0], netInfo.sn[1], netInfo.sn[2], netInfo.sn[3]);
getDNSfromDHCP(netInfo.dns);
coloredMsg(LOG_GREEN, "wizda, DNS: %d.%d.%d.%d", netInfo.dns[0], netInfo.dns[1], netInfo.dns[2], netInfo.dns[3]);
wizchip_setnetinfo(&netInfo);
coloredMsg(LOG_RED, "wizda, set netinfo again");
}
static void wizDHCPUpdate() {
@ -140,6 +151,9 @@ int wizInit() {
wizchip_setnetinfo(&netInfo);
coloredMsg(LOG_RED, "wizI, netinfo set to Ethernet module");
res = wizchip_setnetmode(NM_FORCEARP); // and not NM_PINGBLOCK
coloredMsg(LOG_RED, "wizI, set netmode, result is %d", res);
uint8_t buf[6];
res = ctlwizchip(CW_GET_ID, (void*) buf);
coloredMsg(LOG_RED, "wizI, CW_GET_ID: %d %02x %02x %02x %02x %02x %02x", res, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);