Skip to content

Commit

Permalink
Fix STM32 and Teensy compilation errors of missing _gettimeofday and …
Browse files Browse the repository at this point in the history
…IP to string conversion.
  • Loading branch information
mobizt committed Sep 11, 2023
1 parent c6ce44f commit 806930e
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 19 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ESP Mail Client",
"version": "3.4.10",
"version": "3.4.11",
"keywords": "communication, email, imap, smtp, esp32, esp8266, samd, arduino",
"description": "Arduino E-Mail Client Library to send, read and get incoming email notification for ESP32, ESP8266 and SAMD21 devices. The library also supported other Arduino Devices using Clients interfaces e.g. WiFiClient, EthernetClient, and GSMClient.",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name=ESP Mail Client

version=3.4.10
version=3.4.11

author=Mobizt

Expand Down
2 changes: 1 addition & 1 deletion src/ESP_Mail_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"

#include "ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/ESP_Mail_Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define ESP_MAIL_CLIENT_H

#include "ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand Down
4 changes: 2 additions & 2 deletions src/ESP_Mail_Client_Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#ifndef ESP_MAIL_VERSION

#define ESP_MAIL_VERSION "3.4.10"
#define ESP_MAIL_VERSION_NUM 30410
#define ESP_MAIL_VERSION "3.4.11"
#define ESP_MAIL_VERSION_NUM 30411

/* The inconsistent file version checking to prevent mixed versions compilation. */
#define VALID_VERSION_CHECK(ver) (ver == ESP_MAIL_VERSION_NUM)
Expand Down
2 changes: 1 addition & 1 deletion src/ESP_Mail_Const.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define ESP_MAIL_CONST_H

#include "ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/ESP_Mail_Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define ESP_MAIL_ERROR_H

#include "ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/ESP_Mail_FS.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define ESP_MAIL_CONFIG_H

#include "ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/ESP_Mail_IMAP.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define ESP_MAIL_IMAP_H

#include "ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/ESP_Mail_SMTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#define ESP_MAIL_SMTP_H

#include "ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand Down
7 changes: 3 additions & 4 deletions src/ESP_Mail_TCPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define ESP_MAIL_TCPCLIENT_H

#include "ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand Down Expand Up @@ -1068,9 +1068,8 @@ class ESP_Mail_TCPClient
{
if (ret)
{
MB_String s = MBSTRING_FLASH_MCR("Connected with IP ");
s += Ethernet.localIP().toString();
esp_mail_debug_print_tag(s.c_str(), esp_mail_debug_tag_type_info, true, false);
esp_mail_debug_print_tag((const char *)MBSTRING_FLASH_MCR("Connected with IP "), esp_mail_debug_tag_type_info, false, false);
ESP_MAIL_DEFAULT_DEBUG_PORT.println(Ethernet.localIP());
}
else
esp_mail_debug_print_tag((const char *)MBSTRING_FLASH_MCR("Can't connect"), esp_mail_debug_tag_type_error, true, false);
Expand Down
16 changes: 16 additions & 0 deletions src/SSLClient/client/stm32_time_fix.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

// _gettimeofday link missing in STM32

#if defined(ARDUINO_ARCH_STM32)

#include <sys/time.h>

__attribute__((weak)) int _gettimeofday(struct timeval *tv, void *ignore __attribute__((unused)))
{
uint64_t t = 0;
tv->tv_sec = t / 1000000000;
tv->tv_usec = (t % 1000000000) / 1000;
return 0;
}

#endif
2 changes: 1 addition & 1 deletion src/extras/MB_Time.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define MB_Time_H

#include "./ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand Down
6 changes: 5 additions & 1 deletion src/extras/Networks.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "./ESP_Mail_FS.h"

#include "./ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand All @@ -21,6 +21,10 @@
#include <esp_idf_version.h>
#endif

#if __has_include(<IPAddress.h>)
#include <IPAddress.h>
#endif

#if defined(ESP8266) || defined(MB_ARDUINO_PICO)

#include <string>
Expand Down
2 changes: 1 addition & 1 deletion src/extras/RFC2047.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define RFC2047_CPP

#include "ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/extras/RFC2047.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define RFC2047_H

#include "ESP_Mail_Client_Version.h"
#if !VALID_VERSION_CHECK(30410)
#if !VALID_VERSION_CHECK(30411)
#error "Mixed versions compilation."
#endif

Expand Down

0 comments on commit 806930e

Please sign in to comment.