Réglé plein de bugs... prêt pour le chalet pour vrai...
This commit is contained in:
parent
647f38c4ca
commit
13655e40f4
@ -10,10 +10,12 @@ bool mCAStateReceived;
|
||||
char mMasterData[100];
|
||||
int mMasterDataSize;
|
||||
char mInputString[100];
|
||||
bool mIsDataPending;
|
||||
|
||||
void InitATCmdInterpreter()
|
||||
{
|
||||
mCAStateReceived = false;
|
||||
mIsDataPending = false;
|
||||
}
|
||||
|
||||
int AnalyzeNewATString(char* Str, int StrLen, int CurCmd)
|
||||
@ -169,9 +171,9 @@ int AnalyzeNewATString(char* Str, int StrLen, int CurCmd)
|
||||
}
|
||||
if(strncmp(mInputString,"OK",2) == 0) //The command was executed
|
||||
{
|
||||
// printf("ATCmdInterpreter : Received OK, calling LTEModuleDataReceived\n\r");
|
||||
// printf("ATCmdInterpreter : Received OK, calling LTEModuleDataReceived\n\r");
|
||||
LTEModuleDataReceived(mMasterData,mMasterDataSize);
|
||||
// LTECmdResponseReceived(CurCmd,LTE_MODULE_RESULT_OK);
|
||||
// LTECmdResponseReceived(CurCmd,LTE_MODULE_RESULT_OK);
|
||||
}
|
||||
else if(strncmp(mInputString,"ERROR",5) == 0) //The command was not executed
|
||||
{
|
||||
@ -184,10 +186,25 @@ int AnalyzeNewATString(char* Str, int StrLen, int CurCmd)
|
||||
if(strncmp(mInputString,"OK",2) == 0) //The command was executed
|
||||
{
|
||||
LTECmdResponseReceived(CurCmd,LTE_MODULE_RESULT_OK);
|
||||
if(mIsDataPending == true)
|
||||
{
|
||||
mIsDataPending = false;
|
||||
LTEModuleNewDataReady();
|
||||
}
|
||||
}
|
||||
else if(strncmp(mInputString,"ERROR",5) == 0) //The command was not executed
|
||||
{
|
||||
LTECmdResponseReceived(CurCmd,LTE_MODULE_RESULT_ERROR);
|
||||
if(mIsDataPending == true)
|
||||
{
|
||||
mIsDataPending = false;
|
||||
LTEModuleNewDataReady();
|
||||
}
|
||||
}
|
||||
if(strncmp("+CADATAIND:",mInputString,strlen("+CADATAIND:")) == 0)
|
||||
{
|
||||
// We sometimes receive data while sending...
|
||||
mIsDataPending = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -198,7 +215,7 @@ int AnalyzeNewATString(char* Str, int StrLen, int CurCmd)
|
||||
{
|
||||
if(strncmp("+CADATAIND:",mInputString,strlen("+CADATAIND:")) == 0)
|
||||
{
|
||||
// printf("ATCmdInterpreter : Received +CADATAIND, calling NewDataReady\n\r");
|
||||
// printf("ATCmdInterpreter : Received +CADATAIND, calling NewDataReady\n\r");
|
||||
LTEModuleNewDataReady();
|
||||
}
|
||||
if(strncmp("+APP PDP:",mInputString,strlen("+APP PDP:")) == 0)
|
||||
@ -216,6 +233,12 @@ int AnalyzeNewATString(char* Str, int StrLen, int CurCmd)
|
||||
LTEModuleMasterConnectionStatus(LTE_MODULE_MASTER_DISCONNECTED);
|
||||
}
|
||||
}
|
||||
if(strncmp("+CAURC:",mInputString,strlen("+CAURC:")) == 0)
|
||||
{
|
||||
// printf("ATCmdInterpreter : Received +CADATAIND, calling NewDataReady\n\r");
|
||||
//LTEModuleReset();
|
||||
LTEModuleMasterConnectionStatus(LTE_MODULE_MASTER_DISCONNECTED);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@ void InitLTEModule()
|
||||
|
||||
mMasterConnected = false;
|
||||
mAPNConnected = false;
|
||||
LTENetworkInterfaceInit();
|
||||
}
|
||||
int LTEModuleReset()
|
||||
{
|
||||
@ -186,12 +187,17 @@ void LTEModuleNewData(unsigned char Data)
|
||||
LTESendMasterBufferToModule();
|
||||
}
|
||||
|
||||
if(Data == 0x0A) //Line feed... '\n'
|
||||
if(Data == 0x0A) //Line feed... '\n' Ignore
|
||||
{
|
||||
if(mNbCmdCharsReceived < 2)
|
||||
{
|
||||
mNbCmdCharsReceived = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(mNbCmdCharsReceived >= 2)
|
||||
{
|
||||
if(mATCmd[mNbCmdCharsReceived-2] == 0x0D) //do we have the escape sequence? \r\n ??
|
||||
|
||||
if(Data == 0x0D) //escape sequence \r
|
||||
{
|
||||
|
||||
//check if it's part of a data payload
|
||||
@ -222,7 +228,7 @@ void LTEModuleNewData(unsigned char Data)
|
||||
//Check if we received the whole payload.
|
||||
if(mNbCmdCharsReceived-1 < (DataSize + LenghtSize + 10))
|
||||
{
|
||||
//The \n character is part of the payload, continue receiving...
|
||||
//The \r character is part of the payload, continue receiving...
|
||||
return;
|
||||
|
||||
}
|
||||
@ -235,15 +241,18 @@ void LTEModuleNewData(unsigned char Data)
|
||||
}
|
||||
}
|
||||
else if(mLTEModuleSMState == LTE_MODULE_SM_RUN_STATE)
|
||||
{
|
||||
if(mNbCmdCharsReceived > 1)
|
||||
{
|
||||
AnalyzeNewATString(mATCmd,mNbCmdCharsReceived,mCurrentCmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mNbCmdCharsReceived = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#define VERSIONNUMBER "CHALET_V01.02.1" //shall be 15 chars...
|
||||
#define VERSIONNUMBER "CHALET_V01.02.2" //shall be 15 chars...
|
||||
//Force DHCP instead of static IP.
|
||||
|
||||
//#define VERSIONNUMBER "CHALET_V01.00.1" //shall be 15 chars...
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
#
|
||||
#Thu Jul 10 17:51:07 EDT 2025
|
||||
#Sun Jul 13 10:51:04 EDT 2025
|
||||
ChaletDuinoV2_795F512H_.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc32\\v1.33\\bin
|
||||
default.languagetoolchain.dir=C\:\\Program Files\\Microchip\\xc32\\v1.33\\bin
|
||||
proj.dir=D\:\\Main\\PicDev\\Projets\\ChaletLora\\ChaletLora.X
|
||||
|
||||
@ -1,37 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="11">
|
||||
<file>
|
||||
<url>Source/hd44780.c</url>
|
||||
<bookmark id="7">
|
||||
<name/>
|
||||
<line>340</line>
|
||||
<key/>
|
||||
</bookmark>
|
||||
</file>
|
||||
<file>
|
||||
<url>Source/SIM7080GInterface.c</url>
|
||||
<bookmark id="11">
|
||||
<name/>
|
||||
<line>119</line>
|
||||
<key/>
|
||||
</bookmark>
|
||||
<bookmark id="10">
|
||||
<name/>
|
||||
<line>378</line>
|
||||
<key/>
|
||||
</bookmark>
|
||||
<bookmark id="8">
|
||||
<name/>
|
||||
<line>622</line>
|
||||
<key/>
|
||||
</bookmark>
|
||||
<bookmark id="9">
|
||||
<name/>
|
||||
<line>739</line>
|
||||
<key/>
|
||||
</bookmark>
|
||||
</file>
|
||||
<file>
|
||||
<url>Source/BootloaderInterface.c</url>
|
||||
<bookmark id="5">
|
||||
@ -45,6 +14,37 @@
|
||||
<key/>
|
||||
</bookmark>
|
||||
</file>
|
||||
<file>
|
||||
<url>Source/hd44780.c</url>
|
||||
<bookmark id="7">
|
||||
<name/>
|
||||
<line>340</line>
|
||||
<key/>
|
||||
</bookmark>
|
||||
</file>
|
||||
<file>
|
||||
<url>Source/SIM7080GInterface.c</url>
|
||||
<bookmark id="11">
|
||||
<name/>
|
||||
<line>120</line>
|
||||
<key/>
|
||||
</bookmark>
|
||||
<bookmark id="10">
|
||||
<name/>
|
||||
<line>387</line>
|
||||
<key/>
|
||||
</bookmark>
|
||||
<bookmark id="8">
|
||||
<name/>
|
||||
<line>631</line>
|
||||
<key/>
|
||||
</bookmark>
|
||||
<bookmark id="9">
|
||||
<name/>
|
||||
<line>748</line>
|
||||
<key/>
|
||||
</bookmark>
|
||||
</file>
|
||||
</editor-bookmarks>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group/>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user