4747// rxRindex and rxWindex must be uint8_t and TELNET_RX_BUFFER_SIZE == 256
4848#define TELNET_RX_BUFFER_SIZE 256
4949#define TELNET_MAX_CLIENTS 1
50- #define TELNET_TX_RETRIES_MAX 25
50+ #define TELNET_TX_RETRIES_MAX 50
5151#define TELNET_WAIT_TIME_MS 5
5252#define TELNET_LOGIN_RETRIES_MAX 3
5353#define TELNET_CYCLE_TIME_MS (SERVERS_CYCLE_TIME_MS * 2)
@@ -109,8 +109,8 @@ typedef struct {
109109 ******************************************************************************/
110110static telnet_data_t telnet_data ;
111111static const char * telnet_welcome_msg = "Micro Python " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; " MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME "\r\n" ;
112- static const char * telnet_request_user = "Login as:" ;
113- static const char * telnet_request_password = "Password:" ;
112+ static const char * telnet_request_user = "Login as: " ;
113+ static const char * telnet_request_password = "Password: " ;
114114static const char * telnet_invalid_loggin = "\r\nInvalid credentials, try again.\r\n" ;
115115static const char * telnet_loggin_success = "\r\nLogin succeeded!\r\nType \"help()\" for more information.\r\n" ;
116116static const uint8_t telnet_options_user [] = // IAC WONT ECHO IAC WONT SUPPRESS_GO_AHEAD IAC WILL LINEMODE
@@ -493,6 +493,7 @@ static void telnet_parse_input (uint8_t *str, int16_t *len) {
493493
494494static bool telnet_send_with_retries (int16_t sd , const void * pBuf , int16_t len ) {
495495 int32_t retries = 0 ;
496+ uint32_t delay = TELNET_WAIT_TIME_MS ;
496497 // only if we are not within interrupt context and interrupts are enabled
497498 if ((HAL_NVIC_INT_CTRL_REG & HAL_VECTACTIVE_MASK ) == 0 && query_irq () == IRQ_STATE_ENABLED ) {
498499 do {
@@ -503,7 +504,8 @@ static bool telnet_send_with_retries (int16_t sd, const void *pBuf, int16_t len)
503504 else if (SL_EAGAIN != result ) {
504505 return false;
505506 }
506- HAL_Delay (TELNET_WAIT_TIME_MS );
507+ // start with the default delay and increment it on each retry
508+ HAL_Delay (delay ++ );
507509 } while (++ retries <= TELNET_TX_RETRIES_MAX );
508510 }
509511 return false;
0 commit comments