Skip to content

Commit 8373e90

Browse files
committed
Remove __AVR__ compile options to improve code clarity
1 parent 8e654f9 commit 8373e90

13 files changed

+2
-304
lines changed

Diff for: src/ArduinoIoTCloudTCP.cpp

+1-14
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,7 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
132132
_brokerAddress = brokerAddress;
133133
_brokerPort = brokerPort;
134134

135-
#if defined(__AVR__)
136-
String const nina_fw_version = WiFi.firmwareVersion();
137-
if (nina_fw_version < "1.4.2")
138-
{
139-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s NINA firmware needs to be >= 1.4.2 to support cloud on Uno WiFi Rev. 2, current %s", __FUNCTION__, nina_fw_version.c_str());
140-
return 0;
141-
}
142-
#endif /* AVR */
143-
144-
#if OTA_ENABLED && !defined(__AVR__)
135+
#if OTA_ENABLED
145136
_ota_img_sha256 = OTA::getImageSHA256();
146137
DEBUG_VERBOSE("SHA256: HASH(%d) = %s", strlen(_ota_img_sha256.c_str()), _ota_img_sha256.c_str());
147138
#endif /* OTA_ENABLED */
@@ -483,18 +474,14 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeThingTopics()
483474
if (!_mqttClient.subscribe(_dataTopicIn))
484475
{
485476
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not subscribe to %s", __FUNCTION__, _dataTopicIn.c_str());
486-
#if !defined(__AVR__)
487477
DEBUG_ERROR("Check your thing configuration, and press the reset button on your board.");
488-
#endif
489478
return State::SubscribeThingTopics;
490479
}
491480

492481
if (!_mqttClient.subscribe(_shadowTopicIn))
493482
{
494483
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not subscribe to %s", __FUNCTION__, _shadowTopicIn.c_str());
495-
#if !defined(__AVR__)
496484
DEBUG_ERROR("Check your thing configuration, and press the reset button on your board.");
497-
#endif
498485
return State::SubscribeThingTopics;
499486
}
500487

Diff for: src/cbor/CBORDecoder.h

-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424

2525
#include <Arduino.h>
2626

27-
#ifdef __AVR__
28-
# include <Arduino_AVRSTL.h>
29-
#endif
30-
3127
#undef max
3228
#undef min
3329
#include <list>

Diff for: src/cbor/CBOREncoder.h

-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@
2424

2525
#include <Arduino.h>
2626

27-
#ifdef __AVR__
28-
# include <Arduino_AVRSTL.h>
29-
#endif
30-
3127
#undef max
3228
#undef min
3329
#include <list>

Diff for: src/cbor/lib/tinycbor/src/cbor.h

-5
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525
#ifndef CBOR_H
2626
#define CBOR_H
2727

28-
#ifdef __AVR__
29-
#define FP_NAN NAN
30-
#define FP_INFINITE INFINITY
31-
#endif
32-
3328
#ifndef assert
3429
#include <assert.h>
3530
#endif

Diff for: src/cbor/lib/tinycbor/src/cborpretty.c

-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
# define __STDC_LIMIT_MACROS 1
2929
#endif
3030

31-
#ifndef __AVR__
32-
3331
#include "cbor.h"
3432
#include "cborinternal_p.h"
3533
#include "compilersupport_p.h"
@@ -582,6 +580,4 @@ CborError cbor_value_to_pretty_stream(CborStreamFunction streamFunction, void *t
582580

583581
#pragma GCC diagnostic pop
584582

585-
#endif // __AVR__
586-
587583
/** @} */

Diff for: src/cbor/lib/tinycbor/src/cbortojson.c

-4
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
# define __STDC_LIMIT_MACROS 1
3131
#endif
3232

33-
#ifndef __AVR__
34-
3533
#include "cbor.h"
3634
#include "cborjson.h"
3735
#include "cborinternal_p.h"
@@ -703,6 +701,4 @@ CborError cbor_value_to_json_advance(FILE *out, CborValue *value, int flags)
703701

704702
#pragma GCC diagnostic pop
705703

706-
#endif // __AVR__
707-
708704
/** @} */

Diff for: src/cbor/lib/tinycbor/src/open_memstream.c

-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@
3434

3535
#include <unistd.h>
3636

37-
#ifdef __AVR__
38-
typedef size_t ssize_t;
39-
#endif
40-
4137
typedef ssize_t RetType;
4238
typedef size_t LenType;
4339

Diff for: src/nonstd/nonstd.h

-235
This file was deleted.

Diff for: src/property/Property.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,7 @@ CborError Property::appendAttribute(String value, String attributeName, CborEnco
226226
}, encoder);
227227
}
228228

229-
#ifdef __AVR__
230-
CborError Property::appendAttributeName(String attributeName, nonstd::function<CborError (CborEncoder& mapEncoder)>appendValue, CborEncoder *encoder)
231-
#else
232229
CborError Property::appendAttributeName(String attributeName, std::function<CborError (CborEncoder& mapEncoder)>appendValue, CborEncoder *encoder)
233-
#endif
234230
{
235231
if (attributeName != "") {
236232
// when the attribute name string is not empty, the attribute identifier is incremented in order to be encoded in the message if the _lightPayload flag is set
@@ -319,11 +315,7 @@ void Property::setAttribute(String& value, String attributeName) {
319315
});
320316
}
321317

322-
#ifdef __AVR__
323-
void Property::setAttribute(String attributeName, nonstd::function<void (CborMapData & md)>setValue)
324-
#else
325318
void Property::setAttribute(String attributeName, std::function<void (CborMapData & md)>setValue)
326-
#endif
327319
{
328320
if (attributeName != "") {
329321
_attributeIdentifier++;

0 commit comments

Comments
 (0)