Skip to content

Commit 58bd123

Browse files
committed
ping work
1 parent 05c0b58 commit 58bd123

File tree

7 files changed

+894
-862
lines changed

7 files changed

+894
-862
lines changed

eth_save_process.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ void ehternet_save_process_print(EthernetSaveConfig* config, const char* str) {
292292
}
293293

294294
void ehternet_save_process_free(EthernetSaveConfig* config) {
295+
FURI_LOG_E(TAG, "ehternet_save_process_free");
295296
ethernet_save_process_write(config);
296297
storage_file_close(config->log_file);
297298
storage_file_free(config->log_file);

eth_worker.c

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,19 @@ void eth_log(EthWorkerProcess process, const char* format, ...) {
119119
furi_string_free(fstring);
120120
}
121121

122+
void eth_printf(const char* format, ...) {
123+
furi_assert(static_worker);
124+
va_list args;
125+
va_start(args, format);
126+
FuriString* fstring = furi_string_alloc_vprintf(format, args);
127+
const char* string = furi_string_get_cstr(fstring);
128+
va_end(args);
129+
130+
FURI_LOG_I(TAG, "%s", string);
131+
//ehternet_save_process_print(static_worker->config, string);
132+
furi_string_free(fstring);
133+
}
134+
122135
static void eth_set_force_state(EthWorkerState state) {
123136
EthWorker* worker = static_worker;
124137
furi_assert(worker);
@@ -338,7 +351,7 @@ int32_t eth_worker_task(void* context) {
338351

339352
furi_hal_spi_acquire(&furi_hal_spi_bus_handle_external);
340353
uint8_t W5500FifoSize[2][8] = {{2, 2, 2, 2, 2, 2, 2, 2}, {2, 2, 2, 2, 2, 2, 2, 2}};
341-
uint8_t dhcp_buffer[2000];
354+
uint8_t dhcp_buffer[2048];
342355

343356
reg_wizchip_spi_cbfunc(W5500_ReadByte, W5500_WriteByte);
344357
reg_wizchip_spiburst_cbfunc(W5500_ReadBuff, W5500_WriteBuff);
@@ -417,8 +430,14 @@ int32_t eth_worker_task(void* context) {
417430
}
418431
reg_dhcp_cbfunc(Callback_IPAssigned, Callback_IPAssigned, Callback_IPConflict);
419432
DHCP_init(DHCP_SOCKET, dhcp_buffer);
433+
{
434+
// DHCP_run();
435+
// eth_log(EthWorkerProcessDHCP, "DHCP Send Discover");
436+
// furi_delay_ms(1000);
437+
// DHCP_stop();
438+
}
420439
uint8_t next_cycle = 1;
421-
uint8_t divider = 0;
440+
uint16_t divider = 0;
422441
while(next_cycle && worker->state == EthWorkerStateDHCP) {
423442
uint8_t dhcp_ret = DHCP_run();
424443
switch(dhcp_ret) {
@@ -438,10 +457,10 @@ int32_t eth_worker_task(void* context) {
438457
eth_log(EthWorkerProcessDHCP, "DHCP Failed");
439458
break;
440459
}
441-
furi_delay_ms(100);
442-
if(divider++ % 10 == 0) {
443-
eth_log(EthWorkerProcessDHCP, "DHCP process %d", divider / 10);
444-
if(divider > 250) {
460+
furi_delay_ms(10);
461+
if(divider++ % 100 == 0) {
462+
eth_log(EthWorkerProcessDHCP, "DHCP process %d", divider / 100);
463+
if(divider > 400) {
445464
DHCP_stop();
446465
eth_log(EthWorkerProcessDHCP, "DHCP Stop by timer");
447466
eth_set_force_state(EthWorkerStateInited);

eth_worker_ping.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ void ping_wait_ms(int ms) {
1111
}
1212

1313
uint8_t ping_auto_interface(uint8_t* adress) {
14-
return ping_count(PING_SOCKET, 20, adress);
14+
return ping_auto(PING_SOCKET, adress);
15+
// return ping_count(PING_SOCKET, 20, adress);
1516
}

0 commit comments

Comments
 (0)