i broke it

This commit is contained in:
2024-10-14 02:13:05 +06:00
parent 480a4a1ca5
commit 7d33688e75
12 changed files with 112 additions and 70 deletions

View File

@@ -251,7 +251,7 @@ uint8_t check_DHCP_timeout(void);
void reset_DHCP_timeout(void);
/* Parse message as OFFER and ACK and NACK from DHCP server.*/
int8_t parseDHCPCMSG(void);
int8_t parseDHCPMSG(void);
/* The default handler of ip assign first */
void default_ip_assign(void)
@@ -749,6 +749,9 @@ uint8_t DHCP_run(void)
if (check_DHCP_leasedIP()) {
// Network info assignment from DHCP
dhcp_ip_assign();
#ifdef _DHCP_DEBUG_
printf("> DHCP Success\r\n");
#endif
reset_DHCP_timeout();
dhcp_state = STATE_DHCP_LEASED;
@@ -901,10 +904,17 @@ int8_t check_DHCP_leasedIP(void)
tmp = getRCR();
setRCR(0x03);
#ifdef _DHCP_DEBUG_
printf("\r\n> Check leased IP - %d.%d.%d.%d\r\n", DHCP_allocated_ip[0], DHCP_allocated_ip[1], DHCP_allocated_ip[2], DHCP_allocated_ip[3]);
#endif
// IP conflict detection : ARP request - ARP reply
// Broadcasting ARP Request for check the IP conflict using UDP sendto() function
ret = sendto(DHCP_SOCKET, (uint8_t *)"CHECK_IP_CONFLICT", 17, DHCP_allocated_ip, 5000);
#ifdef _DHCP_DEBUG_
printf("> sendto result : %ld\r\n", ret);
#endif
// RCR value restore
setRCR(tmp);
@@ -964,7 +974,10 @@ void DHCP_init(uint8_t s, uint8_t * buf)
/* Reset the DHCP timeout count and retry count. */
void reset_DHCP_timeout(void)
{
dhcp_tick_1s = 0;
#ifdef _DHCP_DEBUG_
printf("> reset_DHCP_timeout !!!\r\n");
#endif
// dhcp_tick_1s = 0;
dhcp_tick_next = DHCP_WAIT_TIME;
dhcp_retry_count = 0;
}

View File

@@ -57,7 +57,7 @@ extern "C" {
* @details If you want to display debug & processing message, Define _DHCP_DEBUG_
* @note If defined, it depends on <stdio.h>
*/
// #define _DHCP_DEBUG_
#define _DHCP_DEBUG_
/* Retry to processing DHCP */