Skip to content

Commit d7a502c

Browse files
committed
MCU8MASS-2364 Minor corrections
- Correct some serial output for tests - Update atca_config - Make Azure example subscribe to same topic as publishing to
1 parent 6edbd3a commit d7a502c

File tree

8 files changed

+34
-22
lines changed

8 files changed

+34
-22
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"C_Cpp.clang_format_fallbackStyle": "{ IndentWidth: 4, AllowShortLoopsOnASingleLine: true, AllowShortBlocksOnASingleLine: true, ColumnLimit: 80, BinPackParameters: false, BinPackArguments: false, AllowAllParametersOfDeclarationOnNextLine: false, AlignConsecutiveMacros: true, FixNamespaceComments: false, NamespaceIndentation: All, AlignConsecutiveAssignments: true, AlignEscapedNewlines: true, AlignOperands: Align, AlignTrailingComments: true, AllowAllParametersOfDeclarationOnNextLine: false, AllowAllArgumentsOnNextLine: false, PenaltyBreakAssignment: 50, PointerAlignment: Left, ReferenceAlignment: Left }",
1414
"pytest.testing.cwd": "${workspaceFolder}/test",
1515
"python.testing.pytestArgs": [
16-
"--port=COM18",
16+
"--port=COM12",
1717
"--ignore=lib",
1818
"-s"
1919
],

examples/mqtt_azure/mqtt_azure.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <mqtt_client.h>
1414

1515
const char MQTT_PUB_TOPIC_FMT[] PROGMEM = "devices/%s/messages/events/";
16-
const char MQTT_SUB_TOPIC_FMT[] PROGMEM = "%s/messages/devicebound/#";
16+
const char MQTT_SUB_TOPIC_FMT[] PROGMEM = "devices/%s/messages/events/";
1717

1818
static char mqtt_sub_topic[128];
1919
static char mqtt_pub_topic[128];

examples/mqtt_custom_broker/mqtt_custom_broker.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void setup() {
2828
LedCtrl.begin();
2929
LedCtrl.startupCycle();
3030

31-
Log.info(F("Starting MQTT with custom broker example (polling mode)"));
31+
Log.info(F("Starting MQTT with custom broker"));
3232

3333
// Establish LTE connection
3434
if (!Lte.begin()) {

examples/mqtt_low_power/mqtt_low_power.ino

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ static uint32_t counter = 0;
7777

7878
void loop() {
7979

80-
Mcp9808.wake();
81-
Veml3328.wake();
82-
8380
// If we're not using PSM, all connections will be terminated when power
8481
// down is issued, so we need to re-establish s connection
8582
#if !USE_PSM
@@ -113,5 +110,9 @@ void loop() {
113110
#endif
114111

115112
Log.info(F("Woke up!"));
113+
114+
Mcp9808.wake();
115+
Veml3328.wake();
116+
116117
delay(10000);
117118
}

examples/power_save/power_save.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ void setup() {
7878
Mcp9808.shutdown();
7979

8080
// Connecting to the network might fail, so we just retry
81-
while (!Lte.begin()) {}
81+
if (!Lte.begin()) {
82+
Log.error(F("Failed to connect to operator"));
83+
84+
// Halt here
85+
while (true) {}
86+
}
8287

8388
Log.infof(F("Connected to operator: %s\r\n"), Lte.getOperator().c_str());
8489
}

src/cryptoauthlib/atca_config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#define ATCAB_SELFTEST_EN FEATURE_DISABLED
6161
#define ATCAB_SHA_HMAC_EN FEATURE_DISABLED
6262
#define ATCAB_SIGN_INTERNAL_EN FEATURE_DISABLED
63-
#define ATCAB_UPDATEEXTRA_EN FEATURE_DISABLED
63+
#define ATCAB_UPDATEEXTRA_EN FEATURE_ENABLED
6464
#define ATCAB_AES_CCM_RAND_IV_EN FEATURE_DISABLED
6565
#define ATCAB_VERIFY_EXTERN_STORED_MAC_EN FEATURE_DISABLED
6666
#define ATCAB_AES_GFM_EN FEATURE_DISABLED

src/mqtt_client.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ bool MqttClientClass::publish(const char* topic,
726726
timeout_ms)) {
727727
Log.warn(F("Timed out waiting for publish confirmation. Consider "
728728
"increasing timeout for publishing\r\n"));
729+
LedCtrl.off(Led::DATA, true);
729730
return false;
730731
}
731732

@@ -741,6 +742,7 @@ bool MqttClientClass::publish(const char* topic,
741742

742743
Log.error(
743744
F("Failed to retrieve status code from publish notification"));
745+
LedCtrl.off(Led::DATA, true);
744746
return false;
745747
}
746748

test/test_examples.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def example_test_data():
310310
"expectation": "\\[INFO\\] Connecting to operator.{0,}OK!"
311311
},
312312
{
313-
"expectation": "\\[INFO\\] Connecting to AWS.{0,}OK!"
313+
"expectation": "\\[INFO\\] Connecting to MQTT broker.{0,}OK!"
314314
},
315315
{
316316
"expectation": "\\[INFO\\] Published message"
@@ -345,7 +345,7 @@ def example_test_data():
345345
"expectation": "\\[INFO\\] Connecting to operator.{0,}OK!"
346346
},
347347
{
348-
"expectation": "\\[INFO\\] Connecting to Azure IoT Hub.{0,}OK!"
348+
"expectation": "\\[INFO\\] Connecting to MQTT broker.{0,}OK!"
349349
},
350350
{
351351
"expectation": "\\[INFO\\] Published message"
@@ -371,13 +371,13 @@ def example_test_data():
371371
],
372372
"mqtt_custom_broker": [
373373
{
374-
"expectation": "\\[INFO\\] Starting MQTT with custom broker example (polling mode)"
374+
"expectation": "\\[INFO\\] Starting MQTT with custom broker"
375375
},
376376
{
377377
"expectation": "\\[INFO\\] Connecting to operator.{0,}OK!"
378378
},
379379
{
380-
"expectation": "\\[INFO\\] Connecting to broker.{0,}OK!"
380+
"expectation": "\\[INFO\\] Connecting to MQTT broker.{0,}OK!"
381381
},
382382
{
383383
"expectation": "\\[INFO\\] Published message: Hello world: (\\d{1,})"
@@ -410,7 +410,7 @@ def example_test_data():
410410
},
411411
{
412412
"timeout": 90,
413-
"expectation": "\\[INFO\\] Connecting to broker.{0,}OK!"
413+
"expectation": "\\[INFO\\] Connecting to MQTT broker.{0,}OK!"
414414
},
415415
{
416416
"expectation": "\\[INFO\\] Published message: \\d{1,}"
@@ -427,7 +427,7 @@ def example_test_data():
427427
},
428428
{
429429
"timeout": 90,
430-
"expectation": "\\[INFO\\] Connecting to broker.{0,}OK!"
430+
"expectation": "\\[INFO\\] Connecting to MQTT broker.{0,}OK!"
431431
},
432432
{
433433
"expectation": "\\[INFO\\] Published message: \\d{1,}"
@@ -451,7 +451,7 @@ def example_test_data():
451451
"expectation": "\\[INFO\\] Connecting to operator.{0,}OK!"
452452
},
453453
{
454-
"expectation": "\\[INFO\\] Connecting to broker.{0,}OK!"
454+
"expectation": "\\[INFO\\] Connecting to MQTT broker.{0,}OK!"
455455
},
456456
{
457457
"expectation": "\\[INFO\\] Subscribed to mchp_topic"
@@ -495,7 +495,7 @@ def example_test_data():
495495
"expectation": "\\[INFO\\] Not connected to broker. Attempting to connect!"
496496
},
497497
{
498-
"expectation": "\\[INFO\\] Connecting to broker.{0,}OK!"
498+
"expectation": "\\[INFO\\] Connecting to MQTT broker.{0,}OK!"
499499
},
500500
{
501501
"repeat": 5,
@@ -671,9 +671,9 @@ def program(request, backend):
671671
os.mkdir(build_directory)
672672

673673
compilation_return_code = subprocess.run(
674-
["arduino-cli", "compile", f"{sketch_path}", "-b", f"{BOARD_CONFIG}", "--output-dir", f"{build_directory}"], shell=True).returncode
674+
["arduino-cli", "compile", f"{sketch_path}", "-b", f"{BOARD_CONFIG}", "--build-path", f"{build_directory}"], shell=True).returncode
675675

676-
assert compilation_return_code == 0, f"{example_name} failed to compile"
676+
assert compilation_return_code == 0, f"{example_name} failed to compile, return code: {compilation_return_code}"
677677

678678
hex_file = build_directory / f"{os.path.basename(sketch_path)}.hex"
679679

@@ -783,19 +783,23 @@ def test_https_with_header(request, backend, session_config, example_test_data):
783783
run_test(request, backend, session_config, example_test_data)
784784

785785

786-
def test_mqtt_low_power(request, backend, session_config, example_test_data):
786+
def test_mqtt_aws(request, backend, session_config, example_test_data):
787787
run_test(request, backend, session_config, example_test_data)
788788

789789

790-
def test_mqtt_password_authentication(request, backend, session_config, example_test_data):
790+
def test_mqtt_azure(request, backend, session_config, example_test_data):
791791
run_test(request, backend, session_config, example_test_data)
792792

793793

794-
def test_mqtt_polling(request, backend, session_config, example_test_data):
794+
def test_mqtt_custom_broker(request, backend, session_config, example_test_data):
795795
run_test(request, backend, session_config, example_test_data)
796796

797797

798-
def test_mqtt_polling_aws(request, backend, session_config, example_test_data):
798+
def test_mqtt_low_power(request, backend, session_config, example_test_data):
799+
run_test(request, backend, session_config, example_test_data)
800+
801+
802+
def test_mqtt_password_authentication(request, backend, session_config, example_test_data):
799803
run_test(request, backend, session_config, example_test_data)
800804

801805

0 commit comments

Comments
 (0)