Even more RAM reduction
This commit is contained in:
parent
68b8bf084a
commit
4e61bfdf1e
25
DTE.h
25
DTE.h
@ -56,6 +56,31 @@ public:
|
||||
tick = millis();
|
||||
proccess();
|
||||
}
|
||||
|
||||
void SendCommand(const __FlashStringHelper* command, unsigned long timeout, const char* response1, const char* response2 = 0, const char* response3 = 0)
|
||||
{
|
||||
// char cmd[32];
|
||||
|
||||
match = 0;
|
||||
result = EXPECT_BUSY;
|
||||
response[0] = response1;
|
||||
response[1] = response2;
|
||||
response[2] = response3;
|
||||
this->timeout = timeout;
|
||||
// clear rx buffer
|
||||
while (stream.available())
|
||||
{
|
||||
stream.read();
|
||||
}
|
||||
// send command
|
||||
// strcpy_P(cmd, command);
|
||||
stream.print((const __FlashStringHelper *)command);
|
||||
// stream.print(cmd);
|
||||
buffer = "";
|
||||
tick = millis();
|
||||
proccess();
|
||||
}
|
||||
|
||||
void Delay(unsigned long delay)
|
||||
{
|
||||
timeout = delay;
|
||||
|
@ -340,14 +340,14 @@ private:
|
||||
case STARTUP_DELAY:
|
||||
if(millis() - tick >= THREADEDGSM_STARTUP_DELAY)
|
||||
{
|
||||
dte.SendCommand("AT\r", THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
dte.SendCommand(F("AT\r"), THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
state = STARTUP_ENTER_AT;
|
||||
}
|
||||
break;
|
||||
case STARTUP_ENTER_AT:
|
||||
if(dte.getResult() == DTE::EXPECT_RESULT)
|
||||
{
|
||||
dte.SendCommand("AT+CPIN?\r", 10000, "OK\r");
|
||||
dte.SendCommand(F("AT+CPIN?\r"), 10000, "OK\r");
|
||||
state = STARTUP_CHK_CPIN;
|
||||
}
|
||||
else
|
||||
@ -360,7 +360,7 @@ private:
|
||||
{
|
||||
if(dte.getBuffer().indexOf(F("+CPIN: READY")) != -1)
|
||||
{
|
||||
dte.SendCommand("AT+CREG?\r", THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
dte.SendCommand(F("AT+CREG?\r"), THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
state = STARTUP_CHK_CREG;
|
||||
}else
|
||||
{
|
||||
@ -374,7 +374,7 @@ private:
|
||||
{
|
||||
if((dte.getBuffer().indexOf(F(",1")) >= 0) || (dte.getBuffer().indexOf(F(",5")) >= 0))
|
||||
{
|
||||
dte.SendCommand("AT+CLTS=1\r", THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
dte.SendCommand(F("AT+CLTS=1\r"), THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
state = STARTUP_CHK_CLTS;
|
||||
}else
|
||||
state = STARTUP_POWER_OFF;
|
||||
@ -384,7 +384,7 @@ private:
|
||||
case STARTUP_CHK_CLTS:
|
||||
if(dte.getResult() == DTE::EXPECT_RESULT)
|
||||
{
|
||||
dte.SendCommand("AT+CENG=3\r", THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
dte.SendCommand(F("AT+CENG=3\r"), THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
state = STARTUP_CHK_CENG;
|
||||
}else
|
||||
state = STARTUP_POWER_OFF;
|
||||
@ -417,7 +417,7 @@ private:
|
||||
switch(state)
|
||||
{
|
||||
case CLOCK_REQ:
|
||||
dte.SendCommand("AT+CCLK?\r", THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
dte.SendCommand(F("AT+CCLK?\r"), THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
state = CLOCK_VERIFY;
|
||||
break;
|
||||
case CLOCK_VERIFY:
|
||||
@ -465,7 +465,7 @@ private:
|
||||
switch(state)
|
||||
{
|
||||
case SIGNAL_REQ:
|
||||
dte.SendCommand("AT+CSQ\r", THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
dte.SendCommand(F("AT+CSQ\r"), THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
state = SIGNAL_VERIFY;
|
||||
break;
|
||||
case SIGNAL_VERIFY:
|
||||
@ -499,7 +499,7 @@ private:
|
||||
switch(state)
|
||||
{
|
||||
case BATTERY_REQ:
|
||||
dte.SendCommand("AT+CBC\r", THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
dte.SendCommand(F("AT+CBC\r"), THREADEDGSM_AT_TIMEOUT, "OK\r");
|
||||
state = BATTERY_VERIFY;
|
||||
break;
|
||||
case BATTERY_VERIFY:
|
||||
@ -541,13 +541,13 @@ private:
|
||||
case READ_REQ:
|
||||
SMSi.Text = "";
|
||||
SMSi.Number = "";
|
||||
dte.SendCommand("AT+CMGF=0\r", THREADEDGSM_AT_TIMEOUT, "OK\r"); // SMS Message format set as PDU
|
||||
dte.SendCommand(F("AT+CMGF=0\r"), THREADEDGSM_AT_TIMEOUT, "OK\r"); // SMS Message format set as PDU
|
||||
state = READ_CHK_CMGF;
|
||||
break;
|
||||
case READ_CHK_CMGF:
|
||||
if(dte.getResult() == DTE::EXPECT_RESULT)
|
||||
{
|
||||
dte.SendCommand("AT+CPMS=\"SM\"\r", THREADEDGSM_AT_TIMEOUT, "OK\r"); // SIM Message storage
|
||||
dte.SendCommand(F("AT+CPMS=\"SM\"\r"), THREADEDGSM_AT_TIMEOUT, "OK\r"); // SIM Message storage
|
||||
state = READ_CHK_CPMS;
|
||||
}
|
||||
else clearReq(REQ_INBOX);
|
||||
@ -584,7 +584,7 @@ private:
|
||||
break;
|
||||
|
||||
case READ_DELAY_CLEAR_BUFF:
|
||||
dte.SendCommand("AT+CMGF=1\r", THREADEDGSM_AT_TIMEOUT, "OK\r"); // SMS Message format set as TEXT
|
||||
dte.SendCommand(F("AT+CMGF=1\r"), THREADEDGSM_AT_TIMEOUT, "OK\r"); // SMS Message format set as TEXT
|
||||
state = READ_TEXT_CMGR;
|
||||
break;
|
||||
|
||||
@ -657,7 +657,7 @@ private:
|
||||
switch(state)
|
||||
{
|
||||
case SEND_REQ:
|
||||
dte.SendCommand("AT+CMGF=1\r", THREADEDGSM_AT_TIMEOUT, "OK\r"); // SMS Text mode
|
||||
dte.SendCommand(F("AT+CMGF=1\r"), THREADEDGSM_AT_TIMEOUT, "OK\r"); // SMS Text mode
|
||||
state = SEND_CHK_CMGF;
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user