Skip to content

Commit ae1a8ac

Browse files
committed
Clean up code
1 parent ccec6b9 commit ae1a8ac

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

Diff for: src/ArduinoCellular.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ ArduinoCellular::ArduinoCellular() {
1414
}
1515

1616
void ArduinoCellular::begin() {
17-
// set sim slot
1817
modem.init();
19-
2018

2119
String modemInfo = this ->sendATCommand("I");
2220
if(modemInfo.indexOf("EC200A") > 0){
@@ -252,10 +250,10 @@ bool ArduinoCellular::enableGPS(bool assisted){
252250
}
253251

254252
String ArduinoCellular::sendATCommand(const char * command, unsigned long timeout){
255-
String resp;
253+
String response;
256254
modem.sendAT(command);
257-
modem.waitResponse(timeout, resp);
258-
return resp;
255+
modem.waitResponse(timeout, response);
256+
return response;
259257
}
260258

261259
Time parseTimestamp(const String &timestampStr) {

Diff for: src/ModemInterface.cpp

+9-12
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,29 @@
44

55
#include <ModemInterface.h>
66

7-
87
#if defined(ARDUINO_PORTENTA_C33)
8+
#define ON_PIN 32 // P708 (32) is the ON pin
9+
910
// P602/P110/P603/P604 -> Serial1
1011
UART Serial1_FC(UART1_TX_PIN, UART1_RX_PIN, 61, 62);
1112

1213
#ifdef DUMP_AT_COMMANDS
1314
StreamDebugger debugger(Serial1_FC, Serial);
14-
__attribute__ ((init_priority (101))) ModemInterface modem(debugger, 32);
15+
__attribute__ ((init_priority (101))) ModemInterface modem(debugger, ON_PIN);
1516
#else
16-
__attribute__ ((init_priority (101))) ModemInterface modem(Serial1_FC, 32);
17+
__attribute__ ((init_priority (101))) ModemInterface modem(Serial1_FC, ON_PIN);
1718
#endif
1819

19-
// P708 (32) is the ON pin
2020
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(CORE_CM4)
21-
#include "pinDefinitions.h"
22-
21+
#include "pinDefinitions.h"
22+
#define ON_PIN PG_3 // PG3 is the ON pin
2323

24-
// P602/P110/P603/P604 -> Serial1
24+
// P602/P110/P603/P604 -> Serial1
2525
#ifdef DUMP_AT_COMMANDS
2626
StreamDebugger debugger(Serial1, Serial);
27-
__attribute__ ((init_priority (101))) ModemInterface modem(debugger, PinNameToIndex(PG_3));
27+
__attribute__ ((init_priority (101))) ModemInterface modem(debugger, PinNameToIndex(ON_PIN));
2828
#else
29-
__attribute__ ((init_priority (101))) ModemInterface modem(Serial1, PinNameToIndex(PG_3));
29+
__attribute__ ((init_priority (101))) ModemInterface modem(Serial1, PinNameToIndex(ON_PIN));
3030
#endif
3131

32-
33-
34-
// PG3 () is the ON pin
3532
#endif

Diff for: src/ModemInterface.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class ModemInterface : public TinyGsmBG96 {
2626
/**
2727
* @brief Constructor for the ModemInterface class.
2828
* @param stream The stream object for communication with the modem.
29-
* @param power_pin The pin number for controlling the power of the modem.
29+
* @param powerPin The pin number for controlling the power of the modem.
3030
*/
31-
explicit ModemInterface(Stream& stream, int power_pin) : TinyGsmBG96(stream),stream(&stream),power_pin(power_pin) {
31+
explicit ModemInterface(Stream& stream, int powerPin) : TinyGsmBG96(stream),stream(&stream),powerPin(powerPin) {
3232

3333
};
3434

@@ -38,8 +38,8 @@ class ModemInterface : public TinyGsmBG96 {
3838
* @return True if initialization is successful, false otherwise.
3939
*/
4040
bool init(const char* pin = NULL) {
41-
pinMode(power_pin, OUTPUT);
42-
digitalWrite(power_pin, HIGH);
41+
pinMode(powerPin, OUTPUT);
42+
digitalWrite(powerPin, HIGH);
4343
delay(1000);
4444
#ifdef DUMP_AT_COMMANDS
4545
#if defined(ARDUINO_PORTENTA_C33)
@@ -54,7 +54,7 @@ class ModemInterface : public TinyGsmBG96 {
5454

5555
public:
5656
Stream* stream; /**< The stream object for communication with the modem. */
57-
int power_pin; /**< The pin number for controlling the power of the modem. */
57+
int powerPin; /**< The pin number for controlling the power of the modem. */
5858
};
5959

6060
/**

0 commit comments

Comments
 (0)