Skip to content

Commit 516a6e2

Browse files
committed
Add led ctrl for http examples and decrease wait time for operator call
1 parent 565f8d1 commit 516a6e2

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

scripts/make.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
44

5-
TARGET=$SCRIPTPATH/../src/examples/http/http.ino
5+
TARGET=$SCRIPTPATH/../src/examples/http_get_time/http_get_time.ino
66
EXTRA_ARGS=--clean
77

88
if [ "$1" = "clean" ]; then

src/examples/http/http.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <Arduino.h>
22
#include <http_client.h>
3+
#include <led_ctrl.h>
34
#include <log.h>
45
#include <lte.h>
56

@@ -10,6 +11,7 @@ void testHttp();
1011
void setup() {
1112

1213
Log.begin(115200);
14+
LedCtrl.begin();
1315

1416
// Start LTE modem and wait until we are connected to the operator
1517
Lte.begin();

src/examples/http_get_time/http_get_time.ino

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <Arduino.h>
22
#include <http_client.h>
3+
#include <led_ctrl.h>
34
#include <log.h>
45
#include <lte.h>
56

@@ -16,28 +17,30 @@ long getTimeFromApiresp(String *resp) {
1617

1718
void setup() {
1819

20+
LedCtrl.begin();
21+
1922
Log.begin(115200);
2023
Log.info("Starting HTTP Get Time Example\r\n");
2124

2225
// Start LTE modem and wait until we are connected to the operator
2326
Lte.begin();
24-
27+
Log.infof("Connecting to operator");
2528
while (!Lte.isConnected()) {
26-
Log.info("Not connected to operator yet...\r\n");
27-
delay(5000);
29+
Log.raw(".");
30+
delay(1000);
2831
}
2932

30-
Log.info("Connected to operator!\r\n");
33+
Log.raw("\r\n");
34+
Log.infof("Connected to operator: %s\r\n", Lte.getOperator().c_str());
3135

3236
if (!HttpClient.configure(TIMEZONE_URL, 80, false)) {
3337
Log.errorf("Failed to configure the http client for the domain %s\r\n",
3438
TIMEZONE_URL);
3539
return;
3640
}
3741

38-
Log.info("Configured to HTTP\r\n");
42+
Log.info("--- Configured to HTTP ---");
3943

40-
// TODO: Fails, get status code 0
4144
HttpResponse response;
4245
response = HttpClient.get(TIMEZONE_URI);
4346
if (response.status_code != HttpClient.STATUS_OK) {

src/lte.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ String LteClass::getOperator(void) {
185185
uint8_t index = 0;
186186
char buffer[48] = "";
187187

188-
while (SequansController.waitForByte(URC_IDENTIFIER_START_CHARACTER, 500) !=
188+
while (SequansController.waitForByte(URC_IDENTIFIER_START_CHARACTER, 100) !=
189189
SEQUANS_CONTROLLER_READ_BYTE_TIMEOUT) {
190190

191191
while (SequansController.readByte() != URC_IDENTIFIER_END_CHARACTER) {}
@@ -234,7 +234,7 @@ String LteClass::getOperator(void) {
234234

235235
// Clear the rest of the result from querying the operators
236236
while (
237-
SequansController.waitForByte(URC_IDENTIFIER_END_CHARACTER, 500) !=
237+
SequansController.waitForByte(URC_IDENTIFIER_END_CHARACTER, 100) !=
238238
SEQUANS_CONTROLLER_READ_BYTE_TIMEOUT) {}
239239

240240
SequansController.clearReceiveBuffer();

0 commit comments

Comments
 (0)