Compare commits
4 Commits
4f452fc2c1
...
5a9b496503
Author | SHA1 | Date | |
---|---|---|---|
|
5a9b496503 | ||
|
af0a92f4b6 | ||
|
31005dad7f | ||
|
ae8dee45bd |
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
|||||||
#include "LoRaRadio.h"
|
#include "LoRaRadio.h"
|
||||||
|
|
||||||
lmic_pinmap lmic_pins = {0};
|
lmic_pinmap lmic_pins = {0};
|
||||||
|
void (*LoRaRadio::downlinkHandler)(u1_t, u1_t, u1_t*) = NULL;
|
||||||
|
|
||||||
LoRaRadio::LoRaRadio(PinMap pinMap, dr_t dataRate, s1_t txPower) :_pinMap(pinMap), _dataRate(dataRate), _txPower(txPower)
|
LoRaRadio::LoRaRadio(PinMap pinMap, dr_t dataRate, s1_t txPower) :_pinMap(pinMap), _dataRate(dataRate), _txPower(txPower)
|
||||||
{
|
{
|
||||||
@ -62,3 +63,31 @@ void LoRaRadio::run()
|
|||||||
{
|
{
|
||||||
os_runloop_once();
|
os_runloop_once();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoRaRadio::setDownlinkHandler(void (*funcP)(u1_t, u1_t, u1_t*))
|
||||||
|
{
|
||||||
|
downlinkHandler = funcP;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Here, we declare the onEvent function required by the LMIC
|
||||||
|
*/
|
||||||
|
void onEvent(ev_t ev)
|
||||||
|
{
|
||||||
|
switch(ev)
|
||||||
|
{
|
||||||
|
case EV_TXCOMPLETE:
|
||||||
|
//Event telling us that the data was transmitted
|
||||||
|
//It is also here that we check for downlinks
|
||||||
|
if(LMIC.dataLen)
|
||||||
|
{
|
||||||
|
//Data is available
|
||||||
|
if(LoRaRadio::downlinkHandler != NULL)
|
||||||
|
(*LoRaRadio::downlinkHandler)(LMIC.dataLen, LMIC.dataBeg, LMIC.frame);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case EV_RXCOMPLETE:
|
||||||
|
// data received in ping slot
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
#include <hal/hal.h>
|
#include <hal/hal.h>
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
/*
|
||||||
|
* Here, we define the onEvent function required by the LMIC
|
||||||
|
*/
|
||||||
|
void onEvent(ev_t ev);
|
||||||
|
|
||||||
class PinMap
|
class PinMap
|
||||||
{
|
{
|
||||||
@ -32,6 +36,11 @@ class LoRaRadio
|
|||||||
void setMCUClockError(u2_t percent = 30);
|
void setMCUClockError(u2_t percent = 30);
|
||||||
void send(u1_t port, uint8_t *data, uint8_t length, u1_t confirmed = false);
|
void send(u1_t port, uint8_t *data, uint8_t length, u1_t confirmed = false);
|
||||||
void run();
|
void run();
|
||||||
|
void setDownlinkHandler(void (*funcP)(u1_t, u1_t, u1_t*));
|
||||||
|
|
||||||
|
//Function pointers used to interact with events
|
||||||
|
//Parameters : dataLen, dataBeg, dataBuffer
|
||||||
|
static void (*downlinkHandler)(u1_t, u1_t, u1_t*);
|
||||||
protected:
|
protected:
|
||||||
private:
|
private:
|
||||||
dr_t _dataRate;
|
dr_t _dataRate;
|
||||||
|
@ -7,10 +7,6 @@ u1_t dio[3] = {26,33,32};
|
|||||||
void os_getArtEui (u1_t* buf) { }
|
void os_getArtEui (u1_t* buf) { }
|
||||||
void os_getDevEui (u1_t* buf) { }
|
void os_getDevEui (u1_t* buf) { }
|
||||||
void os_getDevKey (u1_t* buf) { }
|
void os_getDevKey (u1_t* buf) { }
|
||||||
void onEvent(ev_t ev)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static u1_t NWKSKEY[16] = { 0x1F, 0x9E, 0xE2, 0x7A, 0xC8, 0xBA, 0xE8, 0xEA, 0xF5, 0xC2, 0x5E, 0x47, 0x5D, 0xE0, 0x77, 0x55 };
|
static u1_t NWKSKEY[16] = { 0x1F, 0x9E, 0xE2, 0x7A, 0xC8, 0xBA, 0xE8, 0xEA, 0xF5, 0xC2, 0x5E, 0x47, 0x5D, 0xE0, 0x77, 0x55 };
|
||||||
static u1_t APPSKEY[16] = { 0x3B, 0x89, 0x86, 0x96, 0xBB, 0xAA, 0x38, 0x1E, 0x1F, 0xC4, 0xAD, 0x03, 0xEF, 0x3F, 0x56, 0x12 };
|
static u1_t APPSKEY[16] = { 0x3B, 0x89, 0x86, 0x96, 0xBB, 0xAA, 0x38, 0x1E, 0x1F, 0xC4, 0xAD, 0x03, 0xEF, 0x3F, 0x56, 0x12 };
|
||||||
|
35
lib/LoRaRadio/keywords.txt
Normal file
35
lib/LoRaRadio/keywords.txt
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#######################################
|
||||||
|
# Syntax Coloring Map LoRaRadio
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Datatypes (KEYWORD1)
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
LoRaRadio KEYWORD1
|
||||||
|
PinMap KEYWORD1
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Methods and Functions (KEYWORD2)
|
||||||
|
#######################################
|
||||||
|
init KEYWORD2
|
||||||
|
setTTNSession KEYWORD2
|
||||||
|
setRadioEUChannels KEYWORD2
|
||||||
|
setMCUClockError KEYWORD2
|
||||||
|
send KEYWORD2
|
||||||
|
run KEYWORD2
|
||||||
|
setDownlinkHandler KEYWORD2
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Constants (LITERAL1)
|
||||||
|
#######################################
|
||||||
|
bit_t LITERAL1
|
||||||
|
u1_t LITERAL1
|
||||||
|
u2_t LITERAL1
|
||||||
|
u4_t LITERAL1
|
||||||
|
s1_t LITERAL1
|
||||||
|
dr_t LITERAL1
|
||||||
|
devaddr_t LITERAL1
|
||||||
|
xref2u1_t LITERAL1
|
||||||
|
DR_SF7 LITERAL1
|
||||||
|
ev_t LITERAL1
|
@ -56,6 +56,100 @@ MeasureUnit::~MeasureUnit()
|
|||||||
|
|
||||||
void MeasureUnit::run()
|
void MeasureUnit::run()
|
||||||
{
|
{
|
||||||
|
switch(_state)
|
||||||
|
{
|
||||||
|
case MEASURING:
|
||||||
|
_adc.startSample(_channel);
|
||||||
|
|
||||||
|
if(_channel == 0) //Calcule du courant
|
||||||
|
{
|
||||||
|
if(_adc.isSampleReady())
|
||||||
|
{
|
||||||
|
_tension = _adc.getSampleVoltage();
|
||||||
|
_courant = _tension / (double) _precResistor;
|
||||||
|
#ifdef DEBUG
|
||||||
|
Serial.print("Tension prec : ");Serial.println(_tension);
|
||||||
|
#endif
|
||||||
|
_channel++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else //Calcule des niveaux de tensions
|
||||||
|
{
|
||||||
|
if(_adc.isSampleReady())
|
||||||
|
{
|
||||||
|
_resistanceMap[_channel-1] = _adc.getSampleVoltage();
|
||||||
|
#ifdef DEBUG
|
||||||
|
Serial.print("Tension thermistances : ");Serial.println(_resistanceMap[_channel-1]);
|
||||||
|
#endif
|
||||||
|
_channel++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Fin de la partie d'acquisition
|
||||||
|
if(_channel == _thermistorCount)
|
||||||
|
{
|
||||||
|
_state = COMPUTING;
|
||||||
|
_resistanceMap[_channel-1] = _adc.getAdcSetting().getVref();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case COMPUTING :
|
||||||
|
//Ici nous calculons les temperatures
|
||||||
|
for(int i(_thermistorCount-1); i > 0; i--)
|
||||||
|
{
|
||||||
|
//Calcule de delta :
|
||||||
|
_resistanceMap[i] -= _resistanceMap[i-1];
|
||||||
|
#ifdef DEBUG
|
||||||
|
Serial.printf("Debug voltage delta : %u -> ",i);Serial.println(_resistanceMap[i]);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
//Ne pas oublier de déduire la chute de tension de la resistance de precision pour la première thermistance
|
||||||
|
_resistanceMap[0] -= _tension;
|
||||||
|
#ifdef DEBUG
|
||||||
|
Serial.printf("Debug voltage delta : 0 -> ");Serial.println(_resistanceMap[0]);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for(int i(0); i < _thermistorCount; i++)
|
||||||
|
{
|
||||||
|
//3) Nous en déduisons la résistance
|
||||||
|
//Serial.print("Resistance ");Serial.print(i);Serial.print(" ");Serial.println(_resistanceMap[i]);
|
||||||
|
_resistanceMap[i] /= _courant;
|
||||||
|
//4) Nous en déduisons la temperature
|
||||||
|
_temperatures[i] = computeTemperature(_thermistorSetting.getBeta(), _resistanceMap[i], _thermistorSetting.getRat25());
|
||||||
|
|
||||||
|
//On effectue un étalonnage
|
||||||
|
if(_triggerLevelOff)
|
||||||
|
{
|
||||||
|
double averageTemp(0);
|
||||||
|
//We reset the offset
|
||||||
|
for(int i(0); i < _thermistorCount; i++)
|
||||||
|
{
|
||||||
|
_rOffsetMap[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i(0); i < _thermistorCount; i++)
|
||||||
|
{
|
||||||
|
averageTemp += _temperatures[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
averageTemp /= (double)_thermistorCount;
|
||||||
|
|
||||||
|
for(int i(0); i < _thermistorCount; i++)
|
||||||
|
{
|
||||||
|
_rOffsetMap[i] = averageTemp - _temperatures[i];
|
||||||
|
}
|
||||||
|
_triggerLevelOff = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_temperatures[i] += _rOffsetMap[i] + _globalOffset;
|
||||||
|
#ifdef DEBUG_TEMP
|
||||||
|
Serial.print("Temperature ");Serial.print(i);Serial.print(" : ");Serial.println(_temperatures[i]);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
_state = MEASUREMENT_READY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(_offsetCounter < _offsetComputeIte && isMeasurementReady())
|
if(_offsetCounter < _offsetComputeIte && isMeasurementReady())
|
||||||
{
|
{
|
||||||
//We reset the offset array
|
//We reset the offset array
|
||||||
@ -238,105 +332,17 @@ double *MeasureUnit::getROffsetMap()
|
|||||||
return _rOffsetMap;
|
return _rOffsetMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureUnit::startTemperatureMeasurement()
|
boolean MeasureUnit::startTemperatureMeasurement()
|
||||||
{
|
{
|
||||||
switch(_state)
|
|
||||||
|
if(_state == IDLING)
|
||||||
{
|
{
|
||||||
case IDLING:
|
_state = MEASURING;
|
||||||
_state = MEASURING;
|
_channel = 0;
|
||||||
_channel = 0;
|
return true;
|
||||||
break;
|
|
||||||
case MEASURING:
|
|
||||||
_adc.startSample(_channel);
|
|
||||||
|
|
||||||
if(_channel == 0) //Calcule du courant
|
|
||||||
{
|
|
||||||
if(_adc.isSampleReady())
|
|
||||||
{
|
|
||||||
_tension = _adc.getSampleVoltage();
|
|
||||||
_courant = _tension / (double) _precResistor;
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.print("Tension prec : ");Serial.println(_tension);
|
|
||||||
#endif
|
|
||||||
_channel++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else //Calcule des niveaux de tensions
|
|
||||||
{
|
|
||||||
if(_adc.isSampleReady())
|
|
||||||
{
|
|
||||||
_resistanceMap[_channel-1] = _adc.getSampleVoltage();
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.print("Tension thermistances : ");Serial.println(_resistanceMap[_channel-1]);
|
|
||||||
#endif
|
|
||||||
_channel++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Fin de la partie d'acquisition
|
|
||||||
if(_channel == _thermistorCount)
|
|
||||||
{
|
|
||||||
_state = COMPUTING;
|
|
||||||
_resistanceMap[_channel-1] = _adc.getAdcSetting().getVref();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case COMPUTING :
|
|
||||||
//Ici nous calculons les temperatures
|
|
||||||
for(int i(_thermistorCount-1); i > 0; i--)
|
|
||||||
{
|
|
||||||
//Calcule de delta :
|
|
||||||
_resistanceMap[i] -= _resistanceMap[i-1];
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.printf("Debug voltage delta : %u -> ",i);Serial.println(_resistanceMap[i]);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//Ne pas oublier de déduire la chute de tension de la resistance de precision pour la première thermistance
|
|
||||||
_resistanceMap[0] -= _tension;
|
|
||||||
#ifdef DEBUG
|
|
||||||
Serial.printf("Debug voltage delta : 0 -> ");Serial.println(_resistanceMap[0]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for(int i(0); i < _thermistorCount; i++)
|
|
||||||
{
|
|
||||||
//3) Nous en déduisons la résistance
|
|
||||||
//Serial.print("Resistance ");Serial.print(i);Serial.print(" ");Serial.println(_resistanceMap[i]);
|
|
||||||
_resistanceMap[i] /= _courant;
|
|
||||||
//4) Nous en déduisons la temperature
|
|
||||||
_temperatures[i] = computeTemperature(_thermistorSetting.getBeta(), _resistanceMap[i], _thermistorSetting.getRat25());
|
|
||||||
|
|
||||||
//On effectue un étalonnage
|
|
||||||
if(_triggerLevelOff)
|
|
||||||
{
|
|
||||||
double averageTemp(0);
|
|
||||||
//We reset the offset
|
|
||||||
for(int i(0); i < _thermistorCount; i++)
|
|
||||||
{
|
|
||||||
_rOffsetMap[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i(0); i < _thermistorCount; i++)
|
|
||||||
{
|
|
||||||
averageTemp += _temperatures[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
averageTemp /= (double)_thermistorCount;
|
|
||||||
|
|
||||||
for(int i(0); i < _thermistorCount; i++)
|
|
||||||
{
|
|
||||||
_rOffsetMap[i] = averageTemp - _temperatures[i];
|
|
||||||
}
|
|
||||||
_triggerLevelOff = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_temperatures[i] += _rOffsetMap[i] + _globalOffset;
|
|
||||||
#ifdef DEBUG_TEMP
|
|
||||||
Serial.print("Temperature ");Serial.print(i);Serial.print(" : ");Serial.println(_temperatures[i]);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
_state = MEASUREMENT_READY;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeasureUnit::levelAsyncTemperaturesOff()
|
void MeasureUnit::levelAsyncTemperaturesOff()
|
||||||
|
@ -23,7 +23,7 @@ class MeasureUnit
|
|||||||
|
|
||||||
//Async methods
|
//Async methods
|
||||||
enum STATE {IDLING, MEASURING, COMPUTING, MEASUREMENT_READY};
|
enum STATE {IDLING, MEASURING, COMPUTING, MEASUREMENT_READY};
|
||||||
void startTemperatureMeasurement();
|
boolean startTemperatureMeasurement();
|
||||||
boolean isMeasurementReady();
|
boolean isMeasurementReady();
|
||||||
double *getAsyncTemperatures();
|
double *getAsyncTemperatures();
|
||||||
void levelAsyncTemperaturesOff();
|
void levelAsyncTemperaturesOff();
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
* 17/12/2019
|
* 17/12/2019
|
||||||
*/
|
*/
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
#include <WiFi.h>
|
||||||
#include <RTClib.h>
|
#include <RTClib.h>
|
||||||
#include <Adafruit_GFX.h>
|
#include <Adafruit_GFX.h>
|
||||||
#include <Adafruit_SSD1306.h>
|
#include <Adafruit_SSD1306.h>
|
||||||
@ -20,11 +21,46 @@
|
|||||||
uint8_t analogInput[] = {0,1,2,3,4,5,6,7};
|
uint8_t analogInput[] = {0,1,2,3,4,5,6,7};
|
||||||
double *tempArray = NULL;
|
double *tempArray = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Liste des offsets trouvés
|
||||||
|
* | -0.49 | 0.36 | -0.29 | 0.38 | 0.44 | -0.35 | -0.21 | 0.14 |
|
||||||
|
* | -0.72 | 0.07 | -0.52 | -0.01 | 2.38 | -0.65 | -0.44 | -0.11 |
|
||||||
|
* | -0.99 | -0.06 | -0.74 | 2.24 | 0.73 | -0.86 | -0.68 | 0.35 |
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
void downlinkHandler(u1_t length, u1_t dataBeg, u1_t *data)
|
||||||
|
{
|
||||||
|
Serial.println("Downlink received : ");
|
||||||
|
for(uint8_t i(0); i < length; i++)
|
||||||
|
{
|
||||||
|
Serial.print(data[dataBeg + i],HEX);
|
||||||
|
}
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
//Action en fonction de l'octet de commande
|
||||||
|
switch(data[0])
|
||||||
|
{
|
||||||
|
case 0x01://Mise à jour de l'heure
|
||||||
|
//Octets suivants:
|
||||||
|
//2 jour 3 mois 4 année 5 heures 6 minutes
|
||||||
|
if(length == 6)
|
||||||
|
{
|
||||||
|
Serial.printf("dd: %u, m: %u, yyyy: %d, hh: %u, mm: %u\n", data[2], data[3], data[4]+2000, data[5], data[6]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Serial.println("Action réglage RTC : paramètres insuffisants");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Serial.println("Action inconnnue");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Objet de calcule de la temperature
|
//Objet de calcule de la temperature
|
||||||
//ThermistorSetting thermistorSetting(3380, 10000);
|
//ThermistorSetting thermistorSetting(3380, 10000);
|
||||||
ThermistorSetting thermistorSetting(3650, 470);
|
ThermistorSetting thermistorSetting(3650, 470);
|
||||||
//AdcSetting adcSetting(3300.0, 12, 310, 3);
|
//AdcSetting adcSetting(3300.0, 12, 310, 3);
|
||||||
AdcSetting adcSetting(3285, 15, 6, 10);
|
AdcSetting adcSetting(3320, 15, 6, 10);
|
||||||
Ads1115 adc;
|
Ads1115 adc;
|
||||||
MeasureUnit measureUnit(analogInput, 8, 990, thermistorSetting, adc);
|
MeasureUnit measureUnit(analogInput, 8, 990, thermistorSetting, adc);
|
||||||
//MeasureUnit measureUnit(analogInput, 8, 99, thermistorSetting, adc);
|
//MeasureUnit measureUnit(analogInput, 8, 99, thermistorSetting, adc);
|
||||||
@ -46,10 +82,6 @@ unsigned long _time(0);
|
|||||||
void os_getArtEui (u1_t* buf) { }
|
void os_getArtEui (u1_t* buf) { }
|
||||||
void os_getDevEui (u1_t* buf) { }
|
void os_getDevEui (u1_t* buf) { }
|
||||||
void os_getDevKey (u1_t* buf) { }
|
void os_getDevKey (u1_t* buf) { }
|
||||||
void onEvent(ev_t ev)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static u1_t NWKSKEY[16] = { 0x1F, 0x9E, 0xE2, 0x7A, 0xC8, 0xBA, 0xE8, 0xEA, 0xF5, 0xC2, 0x5E, 0x47, 0x5D, 0xE0, 0x77, 0x55 };
|
static u1_t NWKSKEY[16] = { 0x1F, 0x9E, 0xE2, 0x7A, 0xC8, 0xBA, 0xE8, 0xEA, 0xF5, 0xC2, 0x5E, 0x47, 0x5D, 0xE0, 0x77, 0x55 };
|
||||||
static u1_t APPSKEY[16] = { 0x3B, 0x89, 0x86, 0x96, 0xBB, 0xAA, 0x38, 0x1E, 0x1F, 0xC4, 0xAD, 0x03, 0xEF, 0x3F, 0x56, 0x12 };
|
static u1_t APPSKEY[16] = { 0x3B, 0x89, 0x86, 0x96, 0xBB, 0xAA, 0x38, 0x1E, 0x1F, 0xC4, 0xAD, 0x03, 0xEF, 0x3F, 0x56, 0x12 };
|
||||||
@ -63,12 +95,20 @@ void setup() {
|
|||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
Serial.println("Start setup");
|
Serial.println("Start setup");
|
||||||
|
WiFi.mode(WIFI_OFF);
|
||||||
pinMode(PUSH_BUTTON, INPUT);
|
pinMode(PUSH_BUTTON, INPUT);
|
||||||
//Radio init
|
//Partie concernant l'initialisation de la radio
|
||||||
#ifdef RADIO_ENABLED
|
#ifdef RADIO_ENABLED
|
||||||
radio.init();
|
radio.init();
|
||||||
radio.setTTNSession(0x1, DEVADDR, NWKSKEY, APPSKEY);
|
radio.setTTNSession(0x1, DEVADDR, NWKSKEY, APPSKEY);
|
||||||
radio.setRadioEUChannels();
|
radio.setRadioEUChannels();
|
||||||
|
/*
|
||||||
|
* La directive setMCUClockError() permet de laisser une fenêtre plus grande pour le slot de
|
||||||
|
* réception (Downlink). En effet ce slot doit durer 2 secondes et il peut durer moins en raison
|
||||||
|
* d'imprécisions d'horloge.
|
||||||
|
*/
|
||||||
|
radio.setMCUClockError();
|
||||||
|
radio.setDownlinkHandler(&(downlinkHandler));
|
||||||
#endif
|
#endif
|
||||||
//Adc init
|
//Adc init
|
||||||
adc.setAdcSetting(adcSetting);
|
adc.setAdcSetting(adcSetting);
|
||||||
@ -103,8 +143,7 @@ void loop() {
|
|||||||
|
|
||||||
//On peut tester si la conversion est terminée avec :
|
//On peut tester si la conversion est terminée avec :
|
||||||
//if(measureUnit.isMeasurementReady())
|
//if(measureUnit.isMeasurementReady())
|
||||||
|
|
||||||
measureUnit.run();
|
|
||||||
//measureUnit.getAsyncTemperatures() renvoie NULL si la recupération de la température n'est pas terminée
|
//measureUnit.getAsyncTemperatures() renvoie NULL si la recupération de la température n'est pas terminée
|
||||||
tempArray = measureUnit.getAsyncTemperatures();
|
tempArray = measureUnit.getAsyncTemperatures();
|
||||||
|
|
||||||
@ -162,4 +201,5 @@ void loop() {
|
|||||||
#ifdef RADIO_ENABLED
|
#ifdef RADIO_ENABLED
|
||||||
radio.run();
|
radio.run();
|
||||||
#endif
|
#endif
|
||||||
|
measureUnit.run();
|
||||||
}
|
}
|
||||||
|
20
lib/PayloadFormatter/keywords.txt
Normal file
20
lib/PayloadFormatter/keywords.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#######################################
|
||||||
|
# Syntax Coloring Map PayloadFormatter
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Datatypes (KEYWORD1)
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
PayloadFormatter KEYWORD1
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Methods and Functions (KEYWORD2)
|
||||||
|
#######################################
|
||||||
|
buildPayload KEYWORD2
|
||||||
|
startSession KEYWORD2
|
||||||
|
endSession KEYWORD2
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Constants (LITERAL1)
|
||||||
|
#######################################
|
Loading…
Reference in New Issue
Block a user