Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-83 committed Sep 19, 2022
2 parents 90aef7a + ab38d8c commit c397343
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 21 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Changelog

#### v 2.1.1 - 2022.09.19
* Fix: fixed an error that occurred when FreeRTOS was not enabled
* Fix: fixed a bug in executeCommandFast function
* Fix: fixed an error in STORE_packet example

#### v 2.1.0 - 2022.07.29
* Upd: ERR_GENERIC was redefined as ERR [#1jz91mu] (https://app.clickup.com/t/1jz91mu)
* Upd: ID_PREFIX removed from `store`, `mstore` and `storeTags` commands [#23v2xn3] (https://app.clickup.com/t/23v2xn3)
* Add: added executeCommandFast command [#394mek4] (https://app.clickup.com/t/394mek4)
* Add: added `mstore` with timestamp argument [#394memb] (https://app.clickup.com/t/394memb)


#### v 2.0.1 - 2022.05.27
* Fix: bug debug for arancino mignon board. [#2g4fxvx] (https://app.clickup.com/t/2g4fxvx)

Expand Down
1 change: 1 addition & 0 deletions examples/Arancino/15-STORE/STORE_Packet/STORE_Packet.ino
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ void loop(){
SERIAL_DEBUG.println("STORE ERROR");
}

Arancino.free(apckt);
delay(2000);

}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void loopTask(void *pvParameters) {
SERIAL_DEBUG.println("STORE ERROR");
}

Arancino.free(apckt);
vTaskDelay(2000);
}
}
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/smartmeio/arancino-library.git"
},
"version": "2.1.0",
"version": "2.1.1",
"authors": {
"name": "smartme.IO",
"url": "https://www.arancino.cc"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Arancino
version=2.1.0
version=2.1.1
author=smartme.IO
maintainer=smartme.IO <[email protected]>
sentence=Enables communication between microcontroller and Arancino Module running mainly in Arancino boards.
Expand Down
44 changes: 27 additions & 17 deletions src/Arancino.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void ArancinoClass::begin(ArancinoMetadata _amdata, ArancinoConfig _acfg)
pinMode(DBG_PIN,INPUT);
if(!digitalRead(DBG_PIN))
Serial.begin(115200);
#endif
#endif

start(keys, values, 7);

Expand Down Expand Up @@ -1243,7 +1243,7 @@ ArancinoPacket ArancinoClass::executeCommand(char *command, char *param1, char *
strLength += param4_length + 1;
}

char *str = (char *)calloc(strLength, sizeof(char));
char *str = (char *)calloc(strLength + 1, sizeof(char));

strcpy(str, command);
if (param1 != NULL)
Expand Down Expand Up @@ -1326,12 +1326,16 @@ ArancinoPacket ArancinoClass::executeCommand(char *command, char *param1, char *
#endif

char *message = NULL;
if (takeCommMutex((TickType_t)portMAX_DELAY) != pdFALSE)
{

#if defined(USEFREERTOS)
if (takeCommMutex((TickType_t)portMAX_DELAY) != pdFALSE) {
#endif
_sendArancinoCommand(str);
message = _receiveArancinoResponse(END_TX_CHAR);
#if defined(USEFREERTOS)
giveCommMutex();
}
#endif

free(str);

Expand Down Expand Up @@ -1387,7 +1391,7 @@ void ArancinoClass::executeCommandFast(char* command, char* param1, char** param
strLength += param4_length + 1;
}

char* str = (char*) calloc(strLength, sizeof(char));
char* str = (char*) calloc(strLength + 1, sizeof(char));

strcpy(str, command);
if(param1 != NULL){
Expand Down Expand Up @@ -1459,11 +1463,14 @@ void ArancinoClass::executeCommandFast(char* command, char* param1, char** param
}
#endif

if (takeCommMutex((TickType_t)portMAX_DELAY) != pdFALSE)
{
#if defined(USEFREERTOS)
if (takeCommMutex((TickType_t)portMAX_DELAY) != pdFALSE) {
#endif
_sendArancinoCommand(str);
#if defined(USEFREERTOS)
giveCommMutex();
}
#endif
free(str);
}

Expand Down Expand Up @@ -1520,12 +1527,15 @@ ArancinoPacket ArancinoClass::executeCommand(char* command, char* param1, char*
strcat(str, endTXStr);

char *message = NULL;
if (takeCommMutex((TickType_t)portMAX_DELAY) != pdFALSE)
{
#if defined(USEFREERTOS)
if (takeCommMutex((TickType_t)portMAX_DELAY) != pdFALSE) {
#endif
_sendArancinoCommand(str);
message = _receiveArancinoResponse(END_TX_CHAR);
#if defined(USEFREERTOS)
giveCommMutex();
}
#endif
free(str);

if (message == NULL)
Expand Down Expand Up @@ -1583,11 +1593,14 @@ void ArancinoClass::executeCommandFast(char* command, char* param1, char* param2
}
strcat(str, endTXStr);

if (takeCommMutex((TickType_t)portMAX_DELAY) != pdFALSE)
{
#if defined(USEFREERTOS)
if (takeCommMutex((TickType_t)portMAX_DELAY) != pdFALSE) {
#endif
_sendArancinoCommand(str);
#if defined(USEFREERTOS)
giveCommMutex();
}
#endif
free(str);

}
Expand Down Expand Up @@ -1828,7 +1841,7 @@ char *ArancinoClass::_parse(char *message)
Serial.print(" ");
Serial.println(value);
}
#endif
#endif

free(status);

Expand Down Expand Up @@ -1920,10 +1933,9 @@ char **ArancinoClass::_parseArray(char *data)
return (data != NULL && arrayParsed != NULL) ? &arrayParsed[1] : NULL;
}

#if defined(USEFREERTOS)
BaseType_t ArancinoClass::takeCommMutex(TickType_t timeout)
{
#if defined(USEFREERTOS)

if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED)
{
if (CommMutex != NULL)
Expand All @@ -1944,10 +1956,8 @@ BaseType_t ArancinoClass::takeCommMutex(TickType_t timeout)
*/
return pdTRUE;
}
#else
return pdTRUE;
#endif
}
#endif

void ArancinoClass::giveCommMutex()
{
Expand Down
2 changes: 2 additions & 0 deletions src/Arancino.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ class ArancinoClass {
char* _parse(char* message);
char** _parseArray(char* message);

#if defined(USEFREERTOS) //The entire prototype would be ill-formed if freertos is not defined
BaseType_t takeCommMutex(TickType_t timeout);
#endif
void giveCommMutex();
void taskSuspend();
void taskResume();
Expand Down
2 changes: 1 addition & 1 deletion src/ArancinoDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ under the License
#define MODLOGLVL_KEY (char*)"___MODLOGLVL___"
#define MODENV_KEY (char*)"___MODENV___"
#define BLINK_ID_KEY (char*)"___BLINK_ID___"
#define LIB_VERSION (char*)"2.0.1" //library version
#define LIB_VERSION (char*)"2.1.1" //library version

//RESPONSE CODE
#define INVALID_VALUE_ERROR -4
Expand Down

0 comments on commit c397343

Please sign in to comment.