Changeset 17971


Ignore:
Timestamp:
09/23/14 19:08:30 (10 years ago)
Author:
dneise
Message:
new GSM features ... now binary will be too large for atmega328p manual linker call might help here.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Arduino/GSM/doms/doms.ino

    r17970 r17971  
    2727
    2828
    29 #define USE_WIRE
     29//#define USE_WIRE
    3030#define USE_ETH
    3131//#define USE_LSM
    32 //#define USE_GSM
     32#define USE_GSM
    3333
    3434#include <SPI.h>
     
    6969    GSM_SMS sms;
    7070    byte gsmStatus = -1; // -1 : unknown
     71    bool use_gsm = false;
    7172#endif
    7273
     
    134135{
    135136#ifdef USE_GSM
    136     if( gsmStatus==GSM_READY )
     137    if (use_gsm && gsmStatus==GSM_READY)
     138    {
     139        // user wants us to use GSM, and GSM seems to be okay.
    137140        checkForSms();
    138     else
    139     {
    140         // try to connect to DSM network again.
     141    } else if (use_gsm && gsmStatus!=GSM_READY)
     142    {
     143        // user wants us to use GSM, but it's not yet okay,
     144        // so we try to connect to GSM network.
    141145        gsmStatus = gsmAccess.begin(PINNUMBER);
     146    } else if (!use_gsm && gsmStatus!=-1)
     147    {
     148        // user does NOT want us to use GSM, but we seem to be connected,
     149        // so let's shut it down.
     150        gsmAccess.shutdown();
     151        // since there is no dedicated 'GSM_SHUTDOWN' status, we simply use -1.
     152        gsmStatus = -1;
     153    } else
     154    {
     155        // user does NOT want us to use GSM and GSM seems to be down ..
     156        // so we don't do anything.
    142157    }
    143158#else
     
    183198                client.println(message);
    184199                break;
     200            case 'g':
     201                use_gsm = true;
     202                break;
     203            case 'G':
     204                use_gsm = false;
     205                break;
     206            case 's':
     207                printStatus(client, true);
     208                break;
    185209          //case 'p':
    186210              //digitalWrite(9, HIGH);
     
    204228    c.println("h help");
    205229    c.println("q quit");
     230    c.println("g/G en-/disable GSM");
     231    c.println("s status");
    206232    c.println();
    207233    c.println("d direction");
     
    210236#endif
    211237}
     238
     239void printStatus(
     240#ifdef USE_ETH
     241    EthernetClient &c,
     242#endif
     243    bool print_via_serial
     244    )
     245{
     246#ifdef USE_ETH
     247    c.print("use_gsm:   ");     c.println(use_gsm);
     248    c.print("gsmStatus: ");     c.println(gsmStatus);
     249#endif
     250    if (print_via_serial)
     251    {
     252        Serial.print("use_gsm:   ");     Serial.println(use_gsm);
     253        Serial.print("gsmStatus: ");     Serial.println(gsmStatus);
     254    }
     255}
     256
    212257
    213258void checkForSms()
Note: See TracChangeset for help on using the changeset viewer.