Compare commits
No commits in common. "19589100eabfc1ff6928d96bce5d57bd872e417f" and "85c43a5951b7c0ca99d25540fb09e46f2532c887" have entirely different histories.
19589100ea
...
85c43a5951
@ -2,8 +2,6 @@
|
||||
* Anatole SCHRAMM-HENRY
|
||||
* Tim THUREL
|
||||
* GROUPE 3
|
||||
*
|
||||
* UPDATE 10/05/2020 : Ajout du décodage de la température externe
|
||||
**/
|
||||
|
||||
function DecodeByteFirstHalf(data) //Data de type byte
|
||||
@ -65,11 +63,9 @@ function Decoder(bytes, port) {
|
||||
|
||||
for (var attrname in date) { decoded[attrname] = date[attrname]; }
|
||||
|
||||
decoded.externTemp = DecodeQ10_6(bytes, 7);
|
||||
|
||||
for(i = 0; i < sensorNbr*2; i+=2)
|
||||
{
|
||||
decoded["t_"+Number(i/2+1)] = DecodeQ10_6(bytes, 9+i);
|
||||
decoded["t_"+Number(i/2+1)] = DecodeQ10_6(bytes, 7+i);
|
||||
}
|
||||
|
||||
listToReturn[0] = decoded;
|
||||
|
@ -91,15 +91,3 @@ void onEvent(ev_t ev)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void LoRaRadio::disableEUChannel(u1_t channel)
|
||||
{
|
||||
LMIC_disableChannel(channel);
|
||||
}
|
||||
|
||||
void LoRaRadio::disableAllEUChannelsBut(u1_t channel)
|
||||
{
|
||||
for(int i(0); i < 9; i++)
|
||||
if(i != channel)
|
||||
LMIC_disableChannel(i);
|
||||
}
|
||||
|
@ -37,8 +37,6 @@ class LoRaRadio
|
||||
void send(u1_t port, uint8_t *data, uint8_t length, u1_t confirmed = false);
|
||||
void run();
|
||||
void setDownlinkHandler(void (*funcP)(u1_t, u1_t, u1_t*));
|
||||
void disableEUChannel(u1_t channel);
|
||||
void disableAllEUChannelsBut(u1_t channel);
|
||||
|
||||
//Function pointers used to interact with events
|
||||
//Parameters : dataLen, dataBeg, dataBuffer
|
||||
|
@ -19,8 +19,6 @@ setMCUClockError KEYWORD2
|
||||
send KEYWORD2
|
||||
run KEYWORD2
|
||||
setDownlinkHandler KEYWORD2
|
||||
disableEUChannel KEYWORD2
|
||||
disableAllEUChannelsBut KEYWORD2
|
||||
|
||||
#######################################
|
||||
# Constants (LITERAL1)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
PayloadFormatter::PayloadFormatter(uint8_t numOfRow, uint8_t numOfColumn) : _totalPayloads(0), _currentPayload(0), _numOfRow(numOfRow), _numOfColumn(numOfColumn), _payload(NULL), _length(0)
|
||||
{
|
||||
_length = (numOfRow * numOfColumn * 2)/* x2 car il faut deux octets pour une température*/ + 7/*pour la date, le numero de trame et le nombre de lignes et de colonnes*/ + 1/*pour le charactère de fin de ligne*/ + 2/*pour la température exterieure*/;
|
||||
_length = numOfRow * numOfColumn * 2 + 7 + 1;
|
||||
_payload = (uint8_t *) calloc(_length, sizeof(uint8_t));
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ boolean PayloadFormatter::endSession()
|
||||
return ret;
|
||||
}
|
||||
|
||||
int16_t PayloadFormatter::buildPayload(uint8_t **buffer, DateTime *dateTime, double externTemp, double *tempArray, uint8_t numOfRow, uint8_t numOfColumn)
|
||||
int16_t PayloadFormatter::buildPayload(uint8_t **buffer, DateTime *dateTime, double *tempArray, uint8_t numOfRow, uint8_t numOfColumn)
|
||||
{
|
||||
*buffer = _payload;
|
||||
if(_currentPayload == _totalPayloads || !_totalPayloads)
|
||||
@ -53,14 +53,8 @@ int16_t PayloadFormatter::buildPayload(uint8_t **buffer, DateTime *dateTime, dou
|
||||
_payload[5] = dateTime->hour();
|
||||
_payload[6] = dateTime->minute();
|
||||
|
||||
//Octets 7 et 8 pour la température extérieure
|
||||
//Format Q10.6
|
||||
int16_t q10_6_extern = round(externTemp * pow(2,6));
|
||||
_payload[7] = q10_6_extern >> 8;
|
||||
_payload[8] = q10_6_extern;
|
||||
|
||||
//Partie temperature interne
|
||||
for(int i(9),j(0); j < (_numOfRow * _numOfColumn); i+=2, j++)
|
||||
//Partie temperature
|
||||
for(int i(7),j(0); j < (_numOfRow * _numOfColumn); i+=2, j++)
|
||||
{
|
||||
//Format Q10.6
|
||||
int16_t q10_6 = round(tempArray[j] * pow(2,6));
|
||||
|
@ -9,7 +9,7 @@ class PayloadFormatter
|
||||
PayloadFormatter(uint8_t numOfRow, uint8_t numOfColumn);
|
||||
~PayloadFormatter();
|
||||
|
||||
int16_t buildPayload(uint8_t **buffer, DateTime *dateTime, double externTemp, double *tempArray, uint8_t numOfRow = -1, uint8_t numOfColumn = -1);
|
||||
int16_t buildPayload(uint8_t **buffer, DateTime *dateTime, double *tempArray, uint8_t numOfRow = -1, uint8_t numOfColumn = -1);
|
||||
void startSession(uint8_t totalPackets);
|
||||
boolean endSession();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user