Hi Juan!
I made the code more simple (see below), but it stills produces the error when reading values on node 1 from AndroidApp.
I use Public the release for Souliss v7.1.1 (commit b549ab50787cd2e385dec0c2038918ee3a199c10).
The gateway (ethernet / rs485):
/**************************************************************************
Souliss -
Gateway for Boulleville
* Arduino Mega
- on board LED on D13
* Ethernet shield (W5100)
- D10 : SS
* TEP custom Shield
- LEDs (Green 34, RED 35, Pink 36 & 37)
- WS2811 output on D7 & D8 for RJ45 1 & 2
- 1Wire on D6 & D14 for RJ45 1 & 2
- RS485-2 : D5=RX/TX, TX2=D16, RX2=D17, Serial2
- RS485-1 : D2=RX/TX, TX1=D18, RX1=D19, Serial1
- RFM12B : D3=irq, PB0=D53:SS
PB3/D50=MISO, PB2/D51=MOSI, PB1/D52=CLK
- Baro : D20D/D21 I2C
- D11 : PWM buzzer
- D42-D49= input_opto_x
- D22-D29 : relays
- D30-D33 : unused
- D38-41 : unused
- D12 / D13 : unused
- D4 unused
- D15/RX3 unused
- ADC0-ADC7 unused
* RS485
A/B lines are on RJ45 1-2
***************************************************************************/
// USART Config
#define USARTBAUDRATE_INSKETCH
#define USART_BAUD19k2 1
// RS485-2
#define USARTDRIVER_INSKETCH
#define USART_TXENABLE 1
#define USART_TXENPIN 5
#define USARTDRIVER Serial2
// Ethernet options -------------------------------------------------------
#define MAC_INSKETCH
uint8_t MAC_ADDRESS[] = {0x90, 0xA2, 0xDA, 0x0E, 0xC0, 0x55};
#define AUTO_MAC 0
// Souliss options --------------------------------------------------------
// Configure the framework
#include "bconf/StandardArduino.h" // Use a standard Arduino
#include "conf/ethW5100.h" // Ethernet through Wiznet W5100
#include "conf/usart.h"
#include "conf/Gateway.h" // The main node is the Gateway
// Include framework code and libraries
#include <SPI.h>
/*** All configuration includes should be above this line ***/
#include "Souliss.h"
enum {
LOGIC_TEP_VMC_ETAGE, // 2 slots
logic_tep_spare1,
LOGIC_TEP_ATM_PRESSURE, // 2 slots
logic_tep_spare2,
LOGIC_TEP_BUZZER,
LOGIC_TEP_LED_ROSE_1,
LOGIC_TEP_NB
};
// Define the network configuration according to your router settings
uint8_t ip_address[4] = {192, 168, 1, 70};
uint8_t subnet_mask[4] = {255, 255, 255, 0};
uint8_t ip_gateway[4] = {192, 168, 1, 1};
#define myvNet_address ip_address[3] // The last byte of the IP address is also the vNet address
// Define the RS485 network configuration
#define myvNet_subnet 0xFF00
#define Gateway_RS485 0xCE01
#define Peer_RS485 0xCE02
//============================================================================
void setup()
{
Serial.begin(115200);
Initialize();
// Set Ethernet network parameters
Souliss_SetIPAddress(ip_address, subnet_mask, ip_gateway); // Address on the Ethernet interface
SetAsGateway(myvNet_address); // Set this node as gateway for SoulissApp
// Set RS485 parameters
SetAddress(Gateway_RS485, myvNet_subnet, 0); // Set the address on the RS485 bus
// This node as gateway will get data from the Peer
SetAsPeerNode(Peer_RS485, 1);
Set_T19(LOGIC_TEP_VMC_ETAGE); // 2 slots
Set_Pressure(LOGIC_TEP_ATM_PRESSURE); // T53 /!\ 2 slots!
Set_PulseOutput(LOGIC_TEP_BUZZER); // T14 / 1 slot
Set_SimpleLight(LOGIC_TEP_LED_ROSE_1); // Define a simple LED light logic
}
// Mean value of atm pressure = 1013.25 hPa
#define DEADBAND_PRESSURE 0.0001 // Deadband value 0.01%, 0.10hPa for 1023°
//============================================================================
void loop()
{
// Here we start to play
EXECUTEFAST() {
UPDATEFAST();
FAST_50ms() { // We process the logic and relevant input and output every 50 milliseconds
// TYPICALS ------------------------------------------------------
Logic_SimpleLight(LOGIC_TEP_LED_ROSE_1);
Logic_PulseOutput(LOGIC_TEP_BUZZER);
Souliss_Logic_T58(memory_map, LOGIC_TEP_ATM_PRESSURE, DEADBAND_PRESSURE, &data_changed);
}
FAST_1110ms() {
static float pressure = 1000.0;
pressure += 1.0;
Souliss_ImportAnalog(memory_map, LOGIC_TEP_ATM_PRESSURE, &pressure);
}
// This node does just networking, bridging the Peer node to the Ethernet network
FAST_GatewayComms();
}
}
The RS485 node:
/**************************************************************************
Souliss -
Node for velux_sud, with RS485 link to gateway.
* Moteino R3 (without RF)
- on board LED on D9.
- debug UART RX/TX: 10/11
* Batibox with RS485 module
- D7 & D8 : buttons input
- 1 wire on D4 (0ohm on SENS_SIGN 1-2, DS18B20 connected on SENSOR 3pins header
1W_SENSOR_ALIM to be set at 5V
* RS485 from D0/D1 (RX/TX) and D3 (to select RX/TX on transceiver)
***************************************************************************/
// USART Config
#define USARTBAUDRATE_INSKETCH
#define USART_BAUD19k2 1
#define USARTDRIVER_INSKETCH
#define USART_TXENABLE 1
#define USART_TXENPIN 3
#define USARTDRIVER Serial
// Configure the framework
#include "bconf/StandardArduino.h" // Use a standard Arduino
#include "conf/usart.h" // USART / RS485 transceiver
/*** All configuration includes should be above this line ***/
#include "Souliss.h"
// Define the RS485 network configuration
#define myvNet_subnet 0xFF00
#define Gateway_RS485 0xCE01
#define Peer_RS485 0xCE02
// Define logic identifiers
enum {
LOGIC_VS_TEMPE_SDB, // 2 slots
logic_vs_spare1,
LOGIC_VS_HUM_SDB, // 2 slots
logic_vs_spare2,
LOGIC_VS_TEMPE_MUR_SUD, // 2 slots
logic_vs_spare3,
LOGIC_VS_NB
};
#define DEADBAND_TEMPE 0.01 // Deadband value 1%, 0.2° for 20°
#define DEADBAND_HUM 0.03 // Deadband value 3%, 1.5° for 50%
//============================================================================
void setup()
{
// Init souliss framework
Initialize();
// Set network parameters
SetAddress(Peer_RS485, myvNet_subnet, Gateway_RS485);
Set_Temperature(LOGIC_VS_TEMPE_SDB); // T52 /!\ 2 slots!
Set_Humidity(LOGIC_VS_HUM_SDB); // T53 /!\ 2 slots!
Set_Temperature(LOGIC_VS_TEMPE_MUR_SUD); // T52 /!\ 2 slots!
}
//============================================================================
void loop()
{
// Here we start to play
EXECUTEFAST() {
UPDATEFAST();
FAST_110ms() {
Souliss_Logic_T52(memory_map, LOGIC_VS_TEMPE_SDB, DEADBAND_TEMPE, &data_changed);
Souliss_Logic_T53(memory_map, LOGIC_VS_HUM_SDB, DEADBAND_HUM, &data_changed);
Souliss_Logic_T52(memory_map, LOGIC_VS_TEMPE_MUR_SUD, DEADBAND_TEMPE, &data_changed);
}
FAST_PeerComms();
}
EXECUTESLOW() {
UPDATESLOW();
// 70 SECONDeS =======================================================
SLOW_10s() {
static float hum = 10.0;
hum += 0.1;
Souliss_ImportAnalog(memory_map, LOGIC_VS_HUM_SDB, &hum);
}
}
}
Thanks for your help!
Regards,
Sylvain