Skip to content

Commit

Permalink
0.2.5
Browse files Browse the repository at this point in the history
+ Some more changes in BaySIM800 library to make modem work more stable.
  • Loading branch information
holzheu committed Jul 6, 2023
1 parent 84d697e commit 2c72bfe
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ A typical example sketch for sending sensordata
look like this. The sketch is optimized for very low power comsumption and unstable
networks.

define SAMPLING_INT 32
#define SAMPLING_INT 32
#define RF24CHANNEL 0x66
#define RF24ADDRESS 0x45c431ae12LL
#define WITH_CHECKSUM 1
Expand All @@ -40,7 +40,7 @@ networks.
client.setBuffer(myBuffer, 100); //use skip!
initLCB(); //init time2
readBatLCB();
startLCB();
startLCB(); //Board blinks 3x
}


Expand All @@ -56,7 +56,7 @@ networks.
#if WITH_CHECKSUM
client.addChecksum();
#endif
sendOrBufferLCB();
sendOrBufferLCB(); //Board blinks 1 time on success and 2 times on error
//Read battery voltage _after_ long uptime!!!
readBatLCB();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ void setup()
myBuffer.init(flash); //This will restore old pointers
//myBuffer.reset(); //This will set all pointers to zero
myBuffer.skip(); //This will move read pointer to write pointer
myBuffer.setRTC(myRTC, 0); //Nutze RTC relativ!
client.setBuffer(myBuffer, 20); //use skip!
myBuffer.setRTC(myRTC, RTC_RELATIVE_SECONDS); //use the rtc clock but relative
client.setBuffer(myBuffer, 120); //use skip!
initLCB(); //init time2
readBatLCB();
startLCB();
Expand Down
14 changes: 10 additions & 4 deletions libraries/BaySIM800/BaySIM800.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ uint8_t BaySIM800::init(void){
printlnP_OK("AT",200);
printlnP("AT+CPIN?");
i++;
if(i>2) return 6;
if(i>2) return 8;
}
if(_base64buffer[4]=='I') return 7; //NOT INSERTED
if(_base64buffer[5]=='U') return 3; //SIM PUK
if(_base64buffer[5]=='I'){ //SIM PIN
printlnP_OK("AT",200);
Expand All @@ -47,19 +48,24 @@ uint8_t BaySIM800::init(void){
if(wait_forOK(30000)) {
return 2; //Wrong PIN
}
wait_for("SMS Ready",20000);
}
for(i=0;i<127;i++){
printlnP("AT+CPIN?");
if(! wait_for("+CPIN: READY",200)) break;
}
if(i==127) return 4; //No +CPIN: READY

// Waiting for Modem to Connect
for(i=0;i<127;i++){
if(isRegistered()) break;
delay(500);
}
if(i==127) return 4;
if(i==127) return 5;
for(i=0;i<127;i++){
if(isAttached()) break;
delay(500);
}
if(i==127) return 5;
if(i==127) return 6;

printlnP_OK("AT+HTTPTERM",200);
printlnP_OK("AT+SAPBR=0,1",200);
Expand Down
7 changes: 4 additions & 3 deletions libraries/BaySIM800/BaySIM800.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ class BaySIM800 : public BayEOS {
* 1 == Communication-ERROR
* 2 == PIN failed
* 3 == PIN locked
* 4 == Not CREG
* 5 == Not CGATT
* 6 == No SIM Card
* 4 == No CPIN READY
* 5 == Not CREG
* 6 == Not CGATT
* 7 == No SIM Card
*
* if unlock_only is set, function returns already after unlocking the modem
*/
Expand Down

0 comments on commit 2c72bfe

Please sign in to comment.