10_FRM.pm: support Firmata firmware without AnalogInputFirmata (Forum #81815)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@15794 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jensb 2018-01-05 19:14:58 +00:00
parent 97410b289e
commit 7be9ff62b7
2 changed files with 33 additions and 33 deletions

View File

@ -1,12 +1,13 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- bugfix: 10_FRM: accept Firmata firmware without AnalogInputFirmata
- bugfix: 10_MYSENSORS_DEVICE: corrected S_LIGHT_LEVEL - bugfix: 10_MYSENSORS_DEVICE: corrected S_LIGHT_LEVEL
- bugfix: 93_DbRep: fix "month out of range" that causes fhem crash - bugfix: 93_DbRep: fix "month out of range" that causes fhem crash
- feature: 20_FRM_PWM: new attribute "restoreOnStartup" - feature: 20_FRM_PWM: new attribute "restoreOnStartup"
- feature: 20_FRM_OUT: new attributes "activeLow" and "valueMode" - feature: 20_FRM_OUT: new attributes "activeLow" and "valueMode"
- feature: 10_FRM: SerialFirmata support - feature: 10_FRM: SerialFirmata support
- update: 10_FRM: OWX IODev assignment - update: 10_FRM: OWX IODev assignment
- update: 10_FRM: Firmata 2.7+ support - update: 10_FRM: Firmata 2.7+ support
- bugfix: 98_weekprofile: fix "error restore topic" - bugfix: 98_weekprofile: fix "error restore topic"
- change: 14_CUL_TCM97001: Fix Logoutput, Fix device output with - change: 14_CUL_TCM97001: Fix Logoutput, Fix device output with
multiple sensors multiple sensors

View File

@ -562,7 +562,7 @@ sub FRM_SetupDevice($) {
} elsif ($hash->{SETUP_STAGE} == 2) { # device capabilities } elsif ($hash->{SETUP_STAGE} == 2) { # device capabilities
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
InternalTimer(gettimeofday() + 1, 'FRM_SetupDevice', $hash, 0); InternalTimer(gettimeofday() + 1, 'FRM_SetupDevice', $hash, 0);
my $capabilitiesReceived = $device->{metadata}{analog_mappings} && $device->{metadata}{capabilities}; my $capabilitiesReceived = $device->{metadata}{capabilities} && ($device->{metadata}{analog_mappings} || ($elapsed >= 5));
if ($capabilitiesReceived) { if ($capabilitiesReceived) {
# device capabilities have been received, convert to readings # device capabilities have been received, convert to readings
my $inputpins = $device->{metadata}{input_pins}; my $inputpins = $device->{metadata}{input_pins};
@ -634,7 +634,6 @@ sub FRM_SetupDevice($) {
# ready, init client modules # ready, init client modules
$hash->{SETUP_STAGE} = 3; $hash->{SETUP_STAGE} = 3;
FRM_SetupDevice($hash); FRM_SetupDevice($hash);
} elsif ($elapsed >= 5) { } elsif ($elapsed >= 5) {
# capabilities receive timeout, abort # capabilities receive timeout, abort
$hash->{SETUP_STAGE} = 5; $hash->{SETUP_STAGE} = 5;
@ -1464,6 +1463,9 @@ sub FRM_Serial_Close {
o OWX support o OWX support
- modified FRM_Client_AssignIOPort: use already assigned IODev - modified FRM_Client_AssignIOPort: use already assigned IODev
04.01.2018 JB
o fix capability query for Firmata firmware without AnalogInputFirmata
=cut =cut
=pod =pod
@ -1556,8 +1558,8 @@ sub FRM_Serial_Close {
</li> </li>
<br> <br>
<li> <li>
If the device is called none, then no device will be opened, so you If the device is called none, then no device will be opened, so you
can experiment without hardware attached.<br> can experiment without hardware attached.<br>
</li> </li>
</ul> </ul>
@ -1579,12 +1581,12 @@ sub FRM_Serial_Close {
<a name="FRMattr"></a> <a name="FRMattr"></a>
<b>Attributes</b><br> <b>Attributes</b><br>
<ul> <ul>
<li>resetDeviceOnConnect<br> <li>resetDeviceOnConnect<br>
Reset the Firmata device immediately after connect to force default Firmata startup state (default: enabled): Reset the Firmata device immediately after connect to force default Firmata startup state (default: enabled):
all pins with analog capability are configured as input, all other (digital) pins are configured as output all pins with analog capability are configured as input, all other (digital) pins are configured as output
and the input pin reporting, the i2c configuration and the serial port configuration are cancelled. and the input pin reporting, the i2c configuration and the serial port configuration are cancelled.
</li><br> </li><br>
<li>i2c-config &lt;write-read-delay&gt;<br> <li>i2c-config &lt;write-read-delay&gt;<br>
Configure the Arduino for ic2 communication. This will enable i2c on the Configure the Arduino for ic2 communication. This will enable i2c on the
i2c_pins received by the capability-query issued during initialization of FRM.<br> i2c_pins received by the capability-query issued during initialization of FRM.<br>
As of Firmata 2.3 you can set a delay-time (in microseconds, max. 32767, default: 0) that will be As of Firmata 2.3 you can set a delay-time (in microseconds, max. 32767, default: 0) that will be
@ -1594,41 +1596,38 @@ sub FRM_Serial_Close {
time required by the connected i2c devices (e.g. 30000 for the BMP180 with triple oversampling, time required by the connected i2c devices (e.g. 30000 for the BMP180 with triple oversampling,
see i2c device manufacturer documentation for details).<br> see i2c device manufacturer documentation for details).<br>
See: <a href="http://www.firmata.org/wiki/Protocol#I2C">Firmata Protocol details about I2C</a> See: <a href="http://www.firmata.org/wiki/Protocol#I2C">Firmata Protocol details about I2C</a>
</li><br> </li><br>
<li>sampling-interval &lt;interval&gt;<br> <li>sampling-interval &lt;interval&gt;<br>
Configure the interval Firmata reports analog data to FRM (in milliseconds, max. 32767, default: 19 ms).<br> Configure the interval Firmata reports analog data to FRM (in milliseconds, max. 32767, default: 19 ms).<br>
See: <a href="http://www.firmata.org/wiki/Protocol#Sampling_Interval">Firmata Protocol details about Sampling Interval</a> See: <a href="http://www.firmata.org/wiki/Protocol#Sampling_Interval">Firmata Protocol details about Sampling Interval</a>
</li><br> </li><br>
<li>software-serial-config &lt;port&gt;:&lt;rx pin&gt;:&lt;tx pin&gt;<br> <li>software-serial-config &lt;port&gt;:&lt;rx pin&gt;:&lt;tx pin&gt;<br>
For using a software serial port (port number 8, 9, 10 or 11) two io pins must be specified. For using a software serial port (port number 8, 9, 10 or 11) two io pins must be specified.
The RX pin must have interrupt capability and the TX pin must have digital output capability.<br> The RX pin must have interrupt capability and the TX pin must have digital output capability.<br>
See: <a href="https://www.arduino.cc/en/Reference/SoftwareSerial">Arduino SoftwareSerial Library</a> See: <a href="https://www.arduino.cc/en/Reference/SoftwareSerial">Arduino SoftwareSerial Library</a>
</li> </li>
</ul> </ul>
<br><br> <br><br>
<a name="FRMnotes"></a> <a name="FRMnotes"></a>
<b>Notes</b><br> <b>Notes</b><br>
<ul> <ul>
<li>ConfigurableFirmata<br> <li>Serial Ports<br>
AnalogInputFirmata must always be enabled, even if not used. Otherwise the device setup will fail with the error <i>Unhandled sysex command</i> when connecting because the pin capability query cannot be completed. Some serial devices can be connected to a serial port of a Firmata device acting as a serial over LAN adapter
</li> if their FHEM modules are using basic DevIo (e.g. HEATRONIC in read only mode) by changing their serial device descriptor to
<li>Serial Ports<br> <br><br>
Some serial devices can be connected to a serial port of a Firmata device acting as a serial over LAN adapter FHEM:DEVIO:&lt;FRM device name&gt;:&lt;serial port&gt;@&lt;baud rate&gt;<br>
if their FHEM modules are using basic DevIo (e.g. HEATRONIC in read only mode) by changing their serial device descriptor to The &lt;serial port&gt; of a pin is its &lt;serial resolution&gt; integer divided by two (e.g. resolution=0/1 -> serial port 0).
<br><br> <br><br>
FHEM:DEVIO:&lt;FRM device name&gt;:&lt;serial port&gt;@&lt;baud rate&gt;<br> To use a serial port both the RX and TX pin of this port must be available via Firmata, even if one of the pins will not be used.
The &lt;serial port&gt; of a pin is its &lt;serial resolution&gt; integer divided by two (e.g. resolution=0/1 -> serial port 0). Depending on the Firmata version the first hardware serial port (port 0) cannot be used even with network connected
<br><br> devices because port 0 is always reserved for the Arduino host communication.
To use a serial port both the RX and TX pin of this port must be available via Firmata, even if one of the pins will not be used. On some Arduinos you can use software serial ports (ports 8 to 11). FRM supports a maximum of one software serial port that can
Depending on the Firmata version the first hardware serial port (port 0) cannot be used even with network connected be activated using the software-serial-config attribute.
devices because port 0 is always reserved for the Arduino host communication. <br><br>
On some Arduinos you can use software serial ports (ports 8 to 11). FRM supports a maximum of one software serial port that can In current Firmata versions the serial options (data bits, parity, stop bits) cannot be configured but may be compiled into the
be activated using the software-serial-config attribute. Firmata Firmware (see SerialFirmata.cpp ((HardwareSerial*)serialPort)->begin(baud, options)).
<br><br> </li>
In current Firmata versions the serial options (data bits, parity, stop bits) cannot be configured but may be compiled into the
Firmata Firmware (see SerialFirmata.cpp ((HardwareSerial*)serialPort)->begin(baud, options)).
</li>
</ul> </ul>
</ul> </ul>
<br> <br>