Browse Source

esp32: Allow to build with uPy floats disabled.

pull/3889/merge
Damien George 6 years ago
parent
commit
349d8e1324
  1. 8
      ports/esp32/modsocket.c
  2. 1
      ports/esp32/mpconfigport.h

8
ports/esp32/modsocket.c

@ -339,7 +339,13 @@ void _socket_settimeout(socket_obj_t *sock, uint64_t timeout_ms) {
STATIC mp_obj_t socket_settimeout(const mp_obj_t arg0, const mp_obj_t arg1) {
socket_obj_t *self = MP_OBJ_TO_PTR(arg0);
if (arg1 == mp_const_none) _socket_settimeout(self, UINT64_MAX);
else _socket_settimeout(self, mp_obj_get_float(arg1) * 1000L);
else {
#if MICROPY_PY_BUILTINS_FLOAT
_socket_settimeout(self, mp_obj_get_float(arg1) * 1000L);
#else
_socket_settimeout(self, mp_obj_get_int(arg1) * 1000);
#endif
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);

1
ports/esp32/mpconfigport.h

@ -38,7 +38,6 @@
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL)
#define MICROPY_WARNINGS (1)
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
#define MICROPY_PY_BUILTINS_COMPLEX (1)
#define MICROPY_CPYTHON_COMPAT (1)
#define MICROPY_STREAMS_NON_BLOCK (1)
#define MICROPY_STREAMS_POSIX_API (1)

Loading…
Cancel
Save