diff --git a/BSB_lan/src/BSB_lan.ino b/BSB_lan/BSB_lan/BSB_lan.ino similarity index 99% rename from BSB_lan/src/BSB_lan.ino rename to BSB_lan/BSB_lan/BSB_lan.ino index f4af6809..bf4aabca 100644 --- a/BSB_lan/src/BSB_lan.ino +++ b/BSB_lan/BSB_lan/BSB_lan.ino @@ -10,10 +10,14 @@ * see README file for more information * * Version: - * 0.1 - 21.01.2015 - initial version + * 0.1 - 21.01.2015 - initial version * 0.5 - 02.02.2015 + * 0.6 - 02.02.2015 * * Changelog: + * version 0.6 + * - renamed SoftwareSerial to BSBSoftwareSerial + * - changed folder structure to enable simple build with arduino sdk * version 0.5 * - bugfixes * - added documentation (README) @@ -30,7 +34,7 @@ */ #include -#include "SoftwareSerial.h" +#include "BSBSoftwareSerial.h" #include "bsb.h" #include diff --git a/BSB_lan/README b/BSB_lan/BSB_lan/README similarity index 85% rename from BSB_lan/README rename to BSB_lan/BSB_lan/README index 189061dc..ff9084bc 100644 --- a/BSB_lan/README +++ b/BSB_lan/BSB_lan/README @@ -34,11 +34,7 @@ Target System: Missing command ids have to be added in the cmdtbl. Until now it is not clear to me, what the differences between the LPB and BSB protocols are. The physical specifications are the same. But may be they differe on the protocol level. Until now I have only connected the system to the BSB. - -Software: - The software is intended to be build with the command line tool ino. If you want to use the arduino sdk you may have to change the - folder structure. - + BEFORE BUILDING the software you have to adapt some parameters in BSB_lan.ino: - MAC address of your ethernet shield. It can be normally found on a label at the shield: byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xEA }; @@ -50,7 +46,9 @@ BEFORE BUILDING the software you have to adapt some parameters in BSB_lan.ino: BSB bus(68,69); - (optional) Activate the usage of the passkey functionality (see below) #define USE_PASSKEY 1 - + - (optional) BSB address (default is 0x06=RGT1, but can be overwritten in the bus initialization) + BSB bus(68,69,); + Interface: A simple syntax description is content of the website displayed when the server is accessed by its simple URL withou any parameters. e.g. http:// @@ -127,3 +125,27 @@ Open issues - Decode DE telegrams. Maybe they contain some status information and we can use them without querying. - Add support of error messages send by the boiler system + + + +Extension: TODO + + Room temperature sensor simulation: + + affected parameters + - 710 - HK1 - Komfortsollwert + - 750 - HK1 - Raumeinfluss + - 700 - HK1 - Betriebsart (0=Schutzbetrieb, 1=Automatik, 2=Reduziert, 3=Komfort) + - INF 10000=Raumtemperatur + - 8740 Diagnose Verbraucher - Raumtemperatur 1 + - 8741 Diagnose Verbraucher - Raumsollwert 1 + + To simulate a room temperature sensor the temperature has to be sent in a regular interval (<10min). + Additionally the boiler can be switched off, when no heating is requested. + When using the PID20 module from fhem, we can try the following approach: + - loop over all PID20 devices + - skip all devices which are not the state processing + - skip all devices with an actuation less than 10 percent + - get the max desired temperature for all not skipped devices + - get the greatest difference from desired and measured temperature for all not skipped devices + - calculate a virtual min measured temperature using this difference diff --git a/BSB_lan/bsb_adapter.pdf b/BSB_lan/BSB_lan/bsb_adapter.pdf similarity index 100% rename from BSB_lan/bsb_adapter.pdf rename to BSB_lan/BSB_lan/bsb_adapter.pdf diff --git a/BSB_lan/ino.ini b/BSB_lan/ino.ini deleted file mode 100644 index c69cf89f..00000000 --- a/BSB_lan/ino.ini +++ /dev/null @@ -1,11 +0,0 @@ - -[build] -board-model = mega2560 - -[upload] -board-model = mega2560 -serial-port = /dev/ttyACM0 - -[serial] -serial-port = /dev/ttyACM0 -baud-rate = 115200 diff --git a/BSB_lan/lib/BSB/SoftwareSerial.cpp b/BSB_lan/libraries/BSB/BSBSoftwareSerial.cpp similarity index 86% rename from BSB_lan/lib/BSB/SoftwareSerial.cpp rename to BSB_lan/libraries/BSB/BSBSoftwareSerial.cpp index 80ddc206..09b9862e 100644 --- a/BSB_lan/lib/BSB/SoftwareSerial.cpp +++ b/BSB_lan/libraries/BSB/BSBSoftwareSerial.cpp @@ -41,7 +41,7 @@ The latest version of this library can always be found at #include #include #include "Arduino.h" -#include "SoftwareSerial.h" +#include "BSBSoftwareSerial.h" // // Lookup table // @@ -122,17 +122,17 @@ const int XMIT_START_ADJUSTMENT = 6; #else -#error This version of SoftwareSerial supports only 20, 16 and 8MHz processors +#error This version of BSBSoftwareSerial supports only 20, 16 and 8MHz processors #endif // // Statics // -SoftwareSerial *SoftwareSerial::active_object = 0; -char SoftwareSerial::_receive_buffer[_SS_MAX_RX_BUFF]; -volatile uint8_t SoftwareSerial::_receive_buffer_tail = 0; -volatile uint8_t SoftwareSerial::_receive_buffer_head = 0; +BSBSoftwareSerial *BSBSoftwareSerial::active_object = 0; +char BSBSoftwareSerial::_receive_buffer[_SS_MAX_RX_BUFF]; +volatile uint8_t BSBSoftwareSerial::_receive_buffer_tail = 0; +volatile uint8_t BSBSoftwareSerial::_receive_buffer_head = 0; // // Debugging @@ -158,7 +158,7 @@ inline void DebugPulse(uint8_t pin, uint8_t count) // /* static */ -inline void SoftwareSerial::tunedDelay(uint16_t delay) { +inline void BSBSoftwareSerial::tunedDelay(uint16_t delay) { uint8_t tmp=0; asm volatile("sbiw %0, 0x01 \n\t" @@ -173,7 +173,7 @@ inline void SoftwareSerial::tunedDelay(uint16_t delay) { // This function sets the current object as the "listening" // one and returns true if it replaces another -bool SoftwareSerial::listen() +bool BSBSoftwareSerial::listen() { if (active_object != this) { @@ -192,7 +192,7 @@ bool SoftwareSerial::listen() // // The receive routine called by the interrupt handler // -void SoftwareSerial::recv() +void BSBSoftwareSerial::recv() { #if GCC_VERSION < 40302 @@ -272,7 +272,7 @@ void SoftwareSerial::recv() #endif } -void SoftwareSerial::tx_pin_write(uint8_t pin_state) +void BSBSoftwareSerial::tx_pin_write(uint8_t pin_state) { if (pin_state == LOW) *_transmitPortRegister &= ~_transmitBitMask; @@ -280,7 +280,7 @@ void SoftwareSerial::tx_pin_write(uint8_t pin_state) *_transmitPortRegister |= _transmitBitMask; } -uint8_t SoftwareSerial::rx_pin_read() +uint8_t BSBSoftwareSerial::rx_pin_read() { return *_receivePortRegister & _receiveBitMask; } @@ -290,7 +290,7 @@ uint8_t SoftwareSerial::rx_pin_read() // /* static */ -inline void SoftwareSerial::handle_interrupt() +inline void BSBSoftwareSerial::handle_interrupt() { if (active_object) { @@ -301,35 +301,35 @@ inline void SoftwareSerial::handle_interrupt() #if defined(PCINT0_vect) ISR(PCINT0_vect) { - SoftwareSerial::handle_interrupt(); + BSBSoftwareSerial::handle_interrupt(); } #endif #if defined(PCINT1_vect) ISR(PCINT1_vect) { - SoftwareSerial::handle_interrupt(); + BSBSoftwareSerial::handle_interrupt(); } #endif #if defined(PCINT2_vect) ISR(PCINT2_vect) { - SoftwareSerial::handle_interrupt(); + BSBSoftwareSerial::handle_interrupt(); } #endif #if defined(PCINT3_vect) ISR(PCINT3_vect) { - SoftwareSerial::handle_interrupt(); + BSBSoftwareSerial::handle_interrupt(); } #endif // // Constructor // -SoftwareSerial::SoftwareSerial(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic /* = false */) : +BSBSoftwareSerial::BSBSoftwareSerial(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic /* = false */) : _rx_delay_centering(0), _rx_delay_intrabit(0), _rx_delay_stopbit(0), @@ -344,12 +344,12 @@ SoftwareSerial::SoftwareSerial(uint8_t receivePin, uint8_t transmitPin, bool inv // // Destructor // -SoftwareSerial::~SoftwareSerial() +BSBSoftwareSerial::~BSBSoftwareSerial() { end(); } -void SoftwareSerial::setTX(uint8_t tx) +void BSBSoftwareSerial::setTX(uint8_t tx) { pinMode(tx, OUTPUT); digitalWrite(tx, LOW); @@ -358,7 +358,7 @@ void SoftwareSerial::setTX(uint8_t tx) _transmitPortRegister = portOutputRegister(port); } -void SoftwareSerial::setRX(uint8_t rx) +void BSBSoftwareSerial::setRX(uint8_t rx) { pinMode(rx, INPUT); if (!_inverse_logic) @@ -373,7 +373,7 @@ void SoftwareSerial::setRX(uint8_t rx) // Public methods // -void SoftwareSerial::begin(long speed) +void BSBSoftwareSerial::begin(long speed) { _rx_delay_centering = _rx_delay_intrabit = _rx_delay_stopbit = _tx_delay = 0; @@ -409,7 +409,7 @@ void SoftwareSerial::begin(long speed) listen(); } -void SoftwareSerial::end() +void BSBSoftwareSerial::end() { if (digitalPinToPCMSK(_receivePin)) *digitalPinToPCMSK(_receivePin) &= ~_BV(digitalPinToPCMSKbit(_receivePin)); @@ -417,7 +417,7 @@ void SoftwareSerial::end() // Read data from buffer -int SoftwareSerial::read() +int BSBSoftwareSerial::read() { if (!isListening()) return -1; @@ -432,7 +432,7 @@ int SoftwareSerial::read() return d; } -int SoftwareSerial::available() +int BSBSoftwareSerial::available() { if (!isListening()) return 0; @@ -440,7 +440,7 @@ int SoftwareSerial::available() return (_receive_buffer_tail + _SS_MAX_RX_BUFF - _receive_buffer_head) % _SS_MAX_RX_BUFF; } -size_t SoftwareSerial::write(byte b) +size_t BSBSoftwareSerial::write(byte b) { if (_tx_delay == 0) { setWriteError(); @@ -487,7 +487,7 @@ size_t SoftwareSerial::write(byte b) return 1; } -void SoftwareSerial::flush() +void BSBSoftwareSerial::flush() { if (!isListening()) return; @@ -498,7 +498,7 @@ void SoftwareSerial::flush() SREG = oldSREG; } -int SoftwareSerial::peek() +int BSBSoftwareSerial::peek() { if (!isListening()) return -1; diff --git a/BSB_lan/lib/BSB/SoftwareSerial.h b/BSB_lan/libraries/BSB/BSBSoftwareSerial.h similarity index 90% rename from BSB_lan/lib/BSB/SoftwareSerial.h rename to BSB_lan/libraries/BSB/BSBSoftwareSerial.h index 90cbfa27..14bc7473 100644 --- a/BSB_lan/lib/BSB/SoftwareSerial.h +++ b/BSB_lan/libraries/BSB/BSBSoftwareSerial.h @@ -29,8 +29,8 @@ The latest version of this library can always be found at http://arduiniana.org. */ -#ifndef SoftwareSerial_h -#define SoftwareSerial_h +#ifndef BSBSoftwareSerial_h +#define BSBSoftwareSerial_h #include #include @@ -51,7 +51,7 @@ The latest version of this library can always be found at #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif -class SoftwareSerial : public Stream +class BSBSoftwareSerial : public Stream { private: // per object data @@ -73,7 +73,7 @@ class SoftwareSerial : public Stream static char _receive_buffer[_SS_MAX_RX_BUFF]; static volatile uint8_t _receive_buffer_tail; static volatile uint8_t _receive_buffer_head; - static SoftwareSerial *active_object; + static BSBSoftwareSerial *active_object; // private methods void recv(); @@ -86,8 +86,8 @@ class SoftwareSerial : public Stream public: // public methods - SoftwareSerial(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic = false); - ~SoftwareSerial(); + BSBSoftwareSerial(uint8_t receivePin, uint8_t transmitPin, bool inverse_logic = false); + ~BSBSoftwareSerial(); void begin(long speed); bool listen(); void end(); diff --git a/BSB_lan/lib/BSB/bsb.cpp b/BSB_lan/libraries/BSB/bsb.cpp similarity index 99% rename from BSB_lan/lib/BSB/bsb.cpp rename to BSB_lan/libraries/BSB/bsb.cpp index 2a9c7af2..3115ec4e 100644 --- a/BSB_lan/lib/BSB/bsb.cpp +++ b/BSB_lan/libraries/BSB/bsb.cpp @@ -10,7 +10,7 @@ // Constructor BSB::BSB(uint8_t rx, uint8_t tx, uint8_t addr) { - serial = new SoftwareSerial(rx, tx, true); + serial = new BSBSoftwareSerial(rx, tx, true); serial->begin(4800); serial->listen(); diff --git a/BSB_lan/lib/BSB/bsb.h b/BSB_lan/libraries/BSB/bsb.h similarity index 93% rename from BSB_lan/lib/BSB/bsb.h rename to BSB_lan/libraries/BSB/bsb.h index 5c34be11..ee66f217 100644 --- a/BSB_lan/lib/BSB/bsb.h +++ b/BSB_lan/libraries/BSB/bsb.h @@ -8,7 +8,7 @@ #include "WProgram.h" #endif -#include "SoftwareSerial.h" +#include "BSBSoftwareSerial.h" #include "util/crc16.h" // See this page for further details: @@ -48,7 +48,7 @@ class BSB inline void _send(byte* msg); uint16_t CRC (byte* buffer, uint8_t length); - SoftwareSerial* serial; + BSBSoftwareSerial* serial; }; #endif diff --git a/BSB_lan/lib/BSB/keywords.txt b/BSB_lan/libraries/BSB/keywords.txt similarity index 100% rename from BSB_lan/lib/BSB/keywords.txt rename to BSB_lan/libraries/BSB/keywords.txt