Skip to content

Commit

Permalink
fixes TEST=wiring/no_fixture_cellular for R510
Browse files Browse the repository at this point in the history
  • Loading branch information
technobly committed Sep 28, 2021
1 parent cc216d4 commit 0001b97
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions user/tests/wiring/no_fixture_cellular/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// make clean all TEST=wiring/no_fixture PLATFORM=electron -s COMPILE_LTO=n program-dfu DEBUG_BUILD=y USE_THREADING=y
//
// Serial1LogHandler logHandler(115200, LOG_LEVEL_ALL, {
// { "comm", LOG_LEVEL_NONE }, // filter out comm messages
// { "system", LOG_LEVEL_INFO } // only info level for system messages
// { "comm", LOG_LEVEL_NONE }, // filter out comm messages
// { "system", LOG_LEVEL_INFO } // only info level for system messages
// });

UNIT_TEST_APP();
Expand Down
28 changes: 16 additions & 12 deletions user/tests/wiring/no_fixture_cellular/cellular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
#include "scope_guard.h"

#if Wiring_Cellular == 1
bool skip_r410 = false;

/**
* Returns current modem type:
* DEV_UNKNOWN, DEV_SARA_G350, DEV_SARA_U260, DEV_SARA_U270, DEV_SARA_U201, DEV_SARA_R410
* DEV_UNKNOWN, DEV_SARA_G350, DEV_SARA_U260, DEV_SARA_U270, DEV_SARA_U201, DEV_SARA_R410, DEV_SARA_R510
*/
int cellular_modem_type() {
CellularDevice device = {};
Expand Down Expand Up @@ -217,12 +216,12 @@ test(CELLULAR_07_urcs) {

#if HAL_PLATFORM_GEN == 2
char string[16];
bool saraR410 = true;
bool saraRxFamily = true;
memset(string, '\0', sizeof(string));

Cellular.command(callbackModemType, string, 10000, "AT+CGMM\r\n");
if (strstr(string, "SARA-R410") == 0) {
saraR410 = false;
if (!strstr(string, "SARA-R410") && !strstr(string, "SARA-R510")) {
saraRxFamily = false;
}
assertEqual(cellular_urcs(false, nullptr), (int)SYSTEM_ERROR_NONE);
assertEqual(Cellular.command(callbackGeneric, string, 10000, "AT+UCIND?\r\n"), (int)RESP_OK);
Expand All @@ -231,7 +230,7 @@ test(CELLULAR_07_urcs) {
assertEqual(strncmp((const char*)string, "0,0,0,0,0", 9), 0);
assertEqual(Cellular.command(callbackGeneric, string, 10000, "AT+CREG?\r\n"), (int)RESP_OK);
assertEqual(strncmp((const char*)string, "0", 1), 0);
if (saraR410) {
if (saraRxFamily) {
assertEqual(Cellular.command(callbackGeneric, string, 10000, "AT+CEREG?\r\n"), (int)RESP_OK);
assertEqual(strncmp((const char*)string, "0", 1), 0);
} else {
Expand All @@ -246,7 +245,7 @@ test(CELLULAR_07_urcs) {
assertEqual(strncmp((const char*)string, "1,0,0,2,1", 9), 0);
assertEqual(Cellular.command(callbackGeneric, string, 10000, "AT+CREG?\r\n"), (int)RESP_OK);
assertEqual(strncmp((const char*)string, "2", 1), 0);
if (saraR410) {
if (saraRxFamily) {
assertEqual(Cellular.command(callbackGeneric, string, 10000, "AT+CEREG?\r\n"), (int)RESP_OK);
assertEqual(strncmp((const char*)string, "2", 1), 0);
} else {
Expand Down Expand Up @@ -362,18 +361,23 @@ static int atCallback(int type, const char* buf, int len, int* lines) {
}

test(MDM_02_at_commands_with_long_response_are_correctly_parsed_and_flow_controlled) {
if (cellular_modem_type() == DEV_QUECTEL_BG96 || \
cellular_modem_type() == DEV_QUECTEL_EG91_E || \
cellular_modem_type() == DEV_QUECTEL_EG91_NA || \
cellular_modem_type() == DEV_QUECTEL_EG91_EX) {
if (cellular_modem_type() == DEV_QUECTEL_BG96 ||
cellular_modem_type() == DEV_QUECTEL_EG91_E ||
cellular_modem_type() == DEV_QUECTEL_EG91_NA ||
cellular_modem_type() == DEV_QUECTEL_EG91_EX) {
Serial.println("TODO: find a command with long response on Quectel NCP");
skip();
return;
}
// R510 does not support AT+CLAC
if (cellular_modem_type() == DEV_SARA_R510) {
Serial.println("TODO: find a command with long response on SARA-R510");
skip();
return;
}

// TODO: Add back this test when SARA R410 supports HW Flow Control?
if (cellular_modem_type() == DEV_SARA_R410) {
skip_r410 = true;
Serial.println("TODO: Add back this test when SARA R410 supports HW Flow Control?");
skip();
return;
Expand Down
3 changes: 2 additions & 1 deletion user/tests/wiring/no_fixture_cellular/cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ test(CLOUD_05_loss_of_cellular_network_connectivity_does_not_cause_full_handshak
});
// Pull the rug, this should cause a socket error on recv/send
#if HAL_PLATFORM_NCP_AT
assertEqual((int)RESP_OK, Cellular.command("AT+CFUN=0,0\r\n"));
// CFUN=0 is the same as CFUN=0,0 for R410. Done this way because R510 errors with CFUN=0,0
assertEqual((int)RESP_OK, Cellular.command("AT+CFUN=0\r\n"));
// Force a publish just in case
(void)Particle.publish("test", "test");
assertEqual((int)RESP_OK, Cellular.command("AT+CFUN=1,0\r\n"));
Expand Down

0 comments on commit 0001b97

Please sign in to comment.