AskSin++ Library

Begonnen von papa, 08 September 2016, 11:11:25

Vorheriges Thema - Nächstes Thema

plombe

#180
ZitatSind denn 2.2 Volt als Minimalspannung realistisch?

Datenblatt ATmega48A/PA/88A/PA/168A/PA/328/P

ZitatOperating Voltage:
1.8 - 5.5V
Speed Grade:
0 - 4MHz@1.8 - 5.5V, 0 - 10MHz@2.7 - 5.5.V, 0 - 20MHz @ 4.5 - 5.5V

CC1101:
Zitat
Parameter                           Min  Max  Unit  Condition
Operating temperature   -40   85    °C     
Operating supply voltage 1.8  3.6     V     All supply pins must have the same voltage
H-G

bjoernh

Zitat von: plombe am 13 Februar 2017, 10:18:52
Datenblatt ATmega48A/PA/88A/PA/168A/PA/328/P

H-G
Aber der cc1101 macht früher schlapp.

Gesendet von meinem Mobile Device.


micky0867

Reply-in-Echtzeit  ;) find ich cool  8) Danke!

Ok, hatte die Möglichkeit von <=4MHz außer Acht gelassen...
Der CC1101 sollte auch noch mit 1.9 Volt laufen...da frage ich mich jetzt, woher 2.2 Volt kommen?
Erfahrungswerte?

Micky

papa

Mehr oder weniger aus der Luft gegriffen. Sollte ein Wert sein, wo alles noch garantiert funktioniert.
Bitte beachtet, dass es sich bei den Examples um Examples handelt, welche die Nutzung der Library zeigen sollen. Da muss nicht immer alles bis in Details ausimplementiert sein. Vielleicht können wir ja auch mal noch Code von "fertigen" Geräten mit aufnehmen. Da gehört dann aber auch immer der Schaltplan und die Fuse-Settings mit dazu.
BananaPi + CUL868 + CUL433 + HM-UART + 1Wire

Dietmar63

@papa:

Wie erzeugst du den Code für die Register?
Ich meine, das trilu irgendetwas generieren kann.

Kann man das für Asksinpp irgendwie nutzen?
Gruß Dietmar
FB7390, CUL, 2 FHT, FS20
modules: 98_WOL.pm, 98_Heating_Control.pm,   98_WeekdayTimer.pm, 98_RandomTimer.pm, 59_Twilight.pm

papa

Der Generator sitzt vor dem Monitor :-)
Musst Du leider alles per Hand schreiben. Im Prinzip könnte man einen Generator schreiben, der die XML-Beschreibungen versteht. Aber die Mühe habe ich mir bisher nicht gemacht.
BananaPi + CUL868 + CUL433 + HM-UART + 1Wire

papa

Ich habe mal eine Branch V1 im GitHub erstellt. Diese stellt den aktuellen, stabilen Stand dar und sollte für eigene Geräte genutzt werden. Hier wird es nur noch Bugfixes geben.
Im Master plane ich einige größere Umbauten, so dass es hier zu Inkompatibilitäten kommen wird.
BananaPi + CUL868 + CUL433 + HM-UART + 1Wire

Dietmar63

Zitat von: papa am 13 Februar 2017, 21:34:19
Der Generator sitzt vor dem Monitor :-)
Musst Du leider alles per Hand schreiben. Im Prinzip könnte man einen Generator schreiben, der die XML-Beschreibungen versteht. Aber die Mühe habe ich mir bisher nicht gemacht.

Hatte trilu nicht so etwas für NewAskSin?

Wenn man da aufsetzen könnte.
Einige getter und setter zu bauen kann ja nicht so schwer sein.
Gruß Dietmar
FB7390, CUL, 2 FHT, FS20
modules: 98_WOL.pm, 98_Heating_Control.pm,   98_WeekdayTimer.pm, 98_RandomTimer.pm, 59_Twilight.pm

Dietmar63

#188
Habe selber was gefunden - in NewAskSin gibt es ein destillregs2
Mal sehen, ob ich das verstehe.

mit perl analyze.pl devicetypes/rf_wds_v1_1.xml habe ich folgendes generiert. Kann man das in AskSinPP verwenden?:


--------------------------------------------------------------------------------------------
This is the register.h content for the analysed xml file
There are several information missing for a comlete register.h configuration
--------------------------------------------------------------------------------------------

#ifndef _REGISTER_h
    #define _REGISTER_h

    /**
     * @brief Settings of HM device
     * firmwareVersion: The firmware version reported by the device
     *                  Sometimes this value is important for select the related device-XML-File
     *
     * modelID:         Important for identification of the device.
     *                  @See Device-XML-File /device/supported_types/type/parameter/const_value
     *
     * subType:         Identifier if device is a switch or a blind or a remote
     * DevInfo:         Sometimes HM-Config-Files are referring on byte 23 for the amount of channels.
     *                  Other bytes not known.
     *                  23:0 0.4, means first four bit of byte 23 reflecting the amount of channels.
     */
    const uint8_t devIdnt[] PROGMEM = {               // HM-Sec-WDS
        /* firmwareVersion 1 byte */  0x11,           // or GE
        /* modelID         2 byte */  0x00,0x45,
        /* subTypeID       1 byte */  0x__,           // replace __ by a valid type id
        /* deviceInfo      3 byte */  0x00,0x00,0x00, // device info not found, replace by valid values
    };

    const uint8_t devIdnt[] PROGMEM = {               // HM-Sec-WDS-2
        /* firmwareVersion 1 byte */  0x13,           // or GE
        /* modelID         2 byte */  0x00,0xb2,
        /* subTypeID       1 byte */  0x__,           // replace __ by a valid type id
        /* deviceInfo      3 byte */  0x00,0x00,0x00, // device info not found, replace by valid values
    };

    /**
     * @brief Register definitions
     * The values are adresses in relation to the start adress defines in cnlTbl
     * Register values can found in related Device-XML-File.
     *
     * Spechial register list 0: 0x0A, 0x0B, 0x0C
     * Spechial register list 1: 0x08
     *
     * @See Defines.h
     *
     * @See: cnlTbl
     */
    const uint8_t cnlAddr[] PROGMEM = {
        // channel: 0, list: 0
        0x09,0x0a,0x0b,0x0c,0x14,
        // channel: 1, list: 1
        0x08,0x20,0x23,0x30,
        // channel: 1, list: 4
        0x01,
        // channel: 2, list: 1, link to 01 01
        // channel: 2, list: 4, link to 01 04
        // channel: 3, list: 1, link to 01 01
        // channel: 3, list: 4, link to 01 04
        // channel: 4, list: 1, link to 01 01
        // channel: 4, list: 4, link to 01 04
        // channel: 5, list: 1, link to 01 01
        // channel: 5, list: 4, link to 01 04
        // channel: 6, list: 1, link to 01 01
        // channel: 6, list: 4, link to 01 04
    }; // 10 byte

    /**
     * @brief Channel - List translation table
     * channel, list, startIndex, start address in EEprom, hidden
     * do not edit the table, if you need more peers edit the defines accordingly.
     */
    #define PHY_ADDR_START 0x20
    #define CNL_01_PEERS   1
    #define CNL_02_PEERS   1
    #define CNL_03_PEERS   1
    #define CNL_04_PEERS   1
    #define CNL_05_PEERS   1
    #define CNL_06_PEERS   1

    const EE::s_cnlTbl cnlTbl[] = {
        // cnl, lst, sIdx, sLen, hide, pAddr
        {    0,   0,    0,    5,    0, PHY_ADDR_START },
        {    1,   1,    5,    4,    0, cnlTbl[0].pAddr + cnlTbl[0].sLen },
        {    1,   4,    9,    1,    0, cnlTbl[1].pAddr + cnlTbl[1].sLen },
        {    2,   1,    5,    4,    0, cnlTbl[2].pAddr + (cnlTbl[2].sLen * CNL_01_PEERS) },
        {    2,   4,    9,    1,    0, cnlTbl[3].pAddr + cnlTbl[3].sLen },
        {    3,   1,    5,    4,    0, cnlTbl[4].pAddr + (cnlTbl[4].sLen * CNL_02_PEERS) },
        {    3,   4,    9,    1,    0, cnlTbl[5].pAddr + cnlTbl[5].sLen },
        {    4,   1,    5,    4,    0, cnlTbl[6].pAddr + (cnlTbl[6].sLen * CNL_03_PEERS) },
        {    4,   4,    9,    1,    0, cnlTbl[7].pAddr + cnlTbl[7].sLen },
        {    5,   1,    5,    4,    0, cnlTbl[8].pAddr + (cnlTbl[8].sLen * CNL_04_PEERS) },
        {    5,   4,    9,    1,    0, cnlTbl[9].pAddr + cnlTbl[9].sLen },
        {    6,   1,    5,    4,    0, cnlTbl[10].pAddr + (cnlTbl[10].sLen * CNL_05_PEERS) },
        {    6,   4,    9,    1,    0, cnlTbl[11].pAddr + cnlTbl[11].sLen },
    }; // 91 byte

    /**
     * @brief Peer-Device-List-Table
     * maximum allowed peers, link to row in cnlTbl, start address in EEprom
     */
    const EE::s_peerTbl peerTbl[] = {
        //    pMax, pLink, pAddr;
        {            0, 0, cnlTbl[12].pAddr + (cnlTbl[12].sLen * CNL_06_PEERS) },
        { CNL_01_PEERS, 2, peerTbl[0].pAddr + (peerTbl[0].pMax * 4) },
        { CNL_02_PEERS, 4, peerTbl[1].pAddr + (peerTbl[1].pMax * 4) },
        { CNL_03_PEERS, 6, peerTbl[2].pAddr + (peerTbl[2].pMax * 4) },
        { CNL_04_PEERS, 8, peerTbl[3].pAddr + (peerTbl[3].pMax * 4) },
        { CNL_05_PEERS, 10, peerTbl[4].pAddr + (peerTbl[4].pMax * 4) },
        { CNL_06_PEERS, 12, peerTbl[5].pAddr + (peerTbl[5].pMax * 4) },
    }; // 28 byte

    /**
     * @brief Struct with basic information for the AskSin library.
     * amount of user channels, amount of lines in the channel table,
     * link to devIdent byte array, link to cnlAddr byte array
     */
    EE::s_devDef devDef = {
        6, 13, devIdnt, cnlAddr,
    };

    /**
     * @brief Sizing of the user module register table.
     * Within this register table all user modules are registered to make
     * them accessible for the AskSin library   
     */
    RG::s_modTable modTbl[6];

#endif

--------------------------------------------------------------------------------------------
This are some additional information especially for developers of user modules
The channel structs reflecting the register content, the frame section shows
which message types are used for the device functionallity
--------------------------------------------------------------------------------------------

/**
* @brief Channel structs (for developers)
* Within the channel struct you will find the definition of the respective registers per channel and list.
* These information is only needed if you want to develop your own channel module, for pre defined
* channel modules all this definitions enclosed in the pre defined module. 
*/

struct s_cnl0_lst0 {
   uint8_t CYCLIC_INFO_MSG           :8;  // 0x09.0, s:8   d: false 
   uint8_t MASTER_ID                 :24; // 0x0a.0, s:24  d:   
   uint8_t TRANSMIT_DEV_TRY_MAX      :8;  // 0x14.0, s:8   d: 6.0 
}; // 5 byte

struct s_cnl1_lst1 {
   uint8_t AES_ACTIVE                :1;  // 0x08.0, s:1   d: false 
   uint8_t                           :7;  // 0x08.1, s:7   d:   
   uint8_t MSG_FOR_POS_C             :2;  // 0x20.2, s:2   d: WATER 
   uint8_t MSG_FOR_POS_B             :2;  // 0x20.4, s:2   d: WET 
   uint8_t MSG_FOR_POS_A             :2;  // 0x20.6, s:2   d: DRY 
   uint8_t EVENT_FILTERTIME          :8;  // 0x23.0, s:8   d: 5.0 s
   uint8_t TRANSMIT_TRY_MAX          :8;  // 0x30.0, s:8   d: 6.0 
}; // 3.75 byte

struct s_cnl1_lst4 {
   uint8_t PEER_NEEDS_BURST          :1;  // 0x01.0, s:1   d: false 
   uint8_t                           :6;  // 0x01.1, s:6   d:   
   uint8_t EXPECT_AES                :1;  // 0x01.7, s:1   d: false 
}; // 1 byte

// struct s_cnl2_lst1 linked to 01 01
// struct s_cnl2_lst4 linked to 01 04
// struct s_cnl3_lst1 linked to 01 01
// struct s_cnl3_lst4 linked to 01 04
// struct s_cnl4_lst1 linked to 01 01
// struct s_cnl4_lst4 linked to 01 04
// struct s_cnl5_lst1 linked to 01 01
// struct s_cnl5_lst4 linked to 01 04
// struct s_cnl6_lst1 linked to 01 01
// struct s_cnl6_lst4 linked to 01 04

/**
* @brief Message description:
*
*        00        01 02    03 04 05  06 07 08  09  10  11   12     13
* Length MSG_Count    Type  Sender__  Receiver  ACK Cnl Stat Action RSSI
* 0F     12        80 02    1E 7A AD  23 70 EC  01  01  BE   20     27    dimmer
* 0E     5C        80 02    1F B7 4A  63 19 63  01  01  C8   00     42    pcb relay
*
* Needed frames:
*
* <frame id="EVENT" direction="from_device" allowed_receivers="BROADCAST,CENTRAL,OTHER" event="true" type="0x41" channel_field="9:0.6">
*      <parameter type="integer" index="11.0" size="1.0" param="STATE"/>
*      <parameter type="integer" index="9.7" size="0.1" param="LOWBAT"/>
* <frame id="INFO_LEVEL" direction="from_device" allowed_receivers="BROADCAST,CENTRAL,OTHER" event="true" type="0x10" subtype="6" subtype_index="9" channel_field="10">
*      <parameter type="integer" index="11.0" size="1.0" param="STATE"/>
*      <parameter type="integer" index="12.7" size="0.1" param="LOWBAT"/>
* <frame id="ACK_STATUS" direction="from_device" allowed_receivers="BROADCAST,CENTRAL,OTHER" event="true" type="0x02" subtype="1" subtype_index="9" channel_field="10">
*      <parameter type="integer" index="11.0" size="1.0" param="STATE"/>
*      <parameter type="integer" index="12.7" size="0.1" param="LOWBAT"/>
*/



Gruß Dietmar
FB7390, CUL, 2 FHT, FS20
modules: 98_WOL.pm, 98_Heating_Control.pm,   98_WeekdayTimer.pm, 98_RandomTimer.pm, 59_Twilight.pm

Linef

trilu hatte im Sommer/Herbst noch dran gebaut - dann allerdings die NewAskSin-Lib komplett umgebaut, so daß das alles nicht mehr notwendig ist.
Jetzt definiert man noch die gewünschten Register mit den Defaultwerten und fertig.
fhem auf cubietruck, HM-USB-CFG-2, CUL-V3, 6x HM-CC-RT-DN, 5x HM-SEC-SD, 2x HM-SEC-SCo, 5x HM Eigenbausensoren, AVR-Heizungsgateway

Dietmar63

Zitat... NewAskSin-Lib komplett umgebaut
kann man sich das irgendwo ansehen?
Gruß Dietmar
FB7390, CUL, 2 FHT, FS20
modules: 98_WOL.pm, 98_Heating_Control.pm,   98_WeekdayTimer.pm, 98_RandomTimer.pm, 59_Twilight.pm

Linef

Bei trilu im DevAES-Zweig oder bei mir im dev-Zweig:
https://github.com/trilu2000/NewAskSin/tree/DevAES
https://github.com/LineF/HM-Sensor

trilu ist aber noch nicht ganz durch - derzeit ist das Dimmer-Modul dran...

Gruss,
Martin
fhem auf cubietruck, HM-USB-CFG-2, CUL-V3, 6x HM-CC-RT-DN, 5x HM-SEC-SD, 2x HM-SEC-SCo, 5x HM Eigenbausensoren, AVR-Heizungsgateway

Dietmar63

ich habe einige Fehler aus  distillRegs ausgebaut, so dass ich jedes xml fehlerfrei in die Datenstruktur verwandeln kann.
Mit ein wenig weiterem Perl könnte man die  getter und setter auch generieren, bzw gleich die Klasse für AskSinPP erzeugen.

z.B:
perl analyze.pl devicetypes/rf_bl.xml



/**
* @brief Channel structs (for developers)
* Within the channel struct you will find the definition of the respective registers per channel and list.
* These information is only needed if you want to develop your own channel module, for pre defined
* channel modules all this definitions enclosed in the pre defined module. 
*/

struct s_cnl0_lst0 {
   uint8_t                           :7;  // 0x02.0, s:7   d:   
   uint8_t INTERNAL_KEYS_VISIBLE     :1;  // 0x02.7, s:1   d: true 
   uint8_t MASTER_ID                 :24; // 0x0a.0, s:24  d:   
   uint8_t CONF_BUTTON_TIME          :8;  // 0x15.0, s:8   d: nF minutes
   uint8_t LOCAL_RESET_DISABLE       :1;  // 0x18.0, s:1   d: false 
   uint8_t                           :7;  // 0x18.1, s:7   d:   
}; // 6 byte

struct s_cnl1_lst1 {
   uint8_t AES_ACTIVE                :1;  // 0x08.0, s:1   d: false 
   uint8_t                           :7;  // 0x08.1, s:7   d:   
   uint8_t REFERENCE_RUNNING_TIME_TOP_BOTTOM :16; // 0x0b.0, s:16  d: 50.0 s
   uint8_t REFERENCE_RUNNING_TIME_BOTTOM_TOP :16; // 0x0d.0, s:16  d: 50.0 s
   uint8_t CHANGE_OVER_DELAY         :8;  // 0x0f.0, s:8   d: 0.5 s
   uint8_t REFERENCE_RUN_COUNTER     :8;  // 0x10.0, s:8   d: nF 
   uint8_t TRANSMIT_TRY_MAX          :8;  // 0x30.0, s:8   d: nF 
   uint8_t STATUSINFO_MINDELAY       :5;  // 0x57.0, s:5   d: 2.0 s
   uint8_t STATUSINFO_RANDOM         :3;  // 0x57.5, s:3   d: 1.0 s
}; // 9 byte

struct s_cnl1_lst3 {
   uint8_t SHORT_CT_RAMPON           :4;  // 0x01.0, s:4   d: X GE COND_VALUE_LO 
   uint8_t SHORT_CT_RAMPOFF          :4;  // 0x01.4, s:4   d: X GE COND_VALUE_LO 
   uint8_t SHORT_CT_ONDELAY          :4;  // 0x02.0, s:4   d: X GE COND_VALUE_LO 
   uint8_t SHORT_CT_OFFDELAY         :4;  // 0x02.4, s:4   d: X GE COND_VALUE_LO 
   uint8_t SHORT_CT_ON               :4;  // 0x03.0, s:4   d: X GE COND_VALUE_LO 
   uint8_t SHORT_CT_OFF              :4;  // 0x03.4, s:4   d: X GE COND_VALUE_LO 
   uint8_t SHORT_COND_VALUE_LO       :8;  // 0x04.0, s:8   d: nF 
   uint8_t SHORT_COND_VALUE_HI       :8;  // 0x05.0, s:8   d: nF 
   uint8_t SHORT_ONDELAY_TIME        :8;  // 0x06.0, s:8   d: 0 s
   uint8_t SHORT_ON_TIME             :8;  // 0x07.0, s:8   d: 111600.0 s
   uint8_t SHORT_OFFDELAY_TIME       :8;  // 0x08.0, s:8   d: 0 s
   uint8_t SHORT_OFF_TIME            :8;  // 0x09.0, s:8   d: 111600.0 s
   uint8_t SHORT_ACTION_TYPE         :2;  // 0x0a.0, s:2   d: JUMP_TO_TARGET 
   uint8_t                           :4;  // 0x0a.2, s:4   d:   
   uint8_t SHORT_OFF_TIME_MODE       :1;  // 0x0a.6, s:1   d: ABSOLUTE 
   uint8_t SHORT_ON_TIME_MODE        :1;  // 0x0a.7, s:1   d: ABSOLUTE 
   uint8_t SHORT_JT_ON               :4;  // 0x0b.0, s:4   d: OFF 
   uint8_t SHORT_JT_OFF              :4;  // 0x0b.4, s:4   d: OFF 
   uint8_t SHORT_JT_ONDELAY          :4;  // 0x0c.0, s:4   d: OFF 
   uint8_t SHORT_JT_OFFDELAY         :4;  // 0x0c.4, s:4   d: OFF 
   uint8_t SHORT_JT_RAMPON           :4;  // 0x0d.0, s:4   d: OFF 
   uint8_t SHORT_JT_RAMPOFF          :4;  // 0x0d.4, s:4   d: OFF 
   uint8_t SHORT_OFF_LEVEL           :8;  // 0x0f.0, s:8   d: 0.0 %
   uint8_t SHORT_ON_LEVEL            :8;  // 0x11.0, s:8   d: 1.0 %
   uint8_t SHORT_CT_REFON            :4;  // 0x1c.0, s:4   d: X GE COND_VALUE_LO 
   uint8_t SHORT_CT_REFOFF           :4;  // 0x1c.4, s:4   d: X GE COND_VALUE_LO 
   uint8_t SHORT_MAX_TIME_FIRST_DIR  :8;  // 0x1d.0, s:8   d: 25.5 s
   uint8_t SHORT_JT_REFON            :4;  // 0x1e.0, s:4   d: OFF 
   uint8_t SHORT_JT_REFOFF           :4;  // 0x1e.4, s:4   d: OFF 
   uint8_t SHORT_DRIVING_MODE        :8;  // 0x1f.0, s:8   d: DRIVE_DIRECTLY 
   uint8_t LONG_CT_RAMPON            :4;  // 0x81.0, s:4   d: X GE COND_VALUE_LO 
   uint8_t LONG_CT_RAMPOFF           :4;  // 0x81.4, s:4   d: X GE COND_VALUE_LO 
   uint8_t LONG_CT_ONDELAY           :4;  // 0x82.0, s:4   d: X GE COND_VALUE_LO 
   uint8_t LONG_CT_OFFDELAY          :4;  // 0x82.4, s:4   d: X GE COND_VALUE_LO 
   uint8_t LONG_CT_ON                :4;  // 0x83.0, s:4   d: X GE COND_VALUE_LO 
   uint8_t LONG_CT_OFF               :4;  // 0x83.4, s:4   d: X GE COND_VALUE_LO 
   uint8_t LONG_COND_VALUE_LO        :8;  // 0x84.0, s:8   d: nF 
   uint8_t LONG_COND_VALUE_HI        :8;  // 0x85.0, s:8   d: nF 
   uint8_t LONG_ONDELAY_TIME         :8;  // 0x86.0, s:8   d: 0 s
   uint8_t LONG_ON_TIME              :8;  // 0x87.0, s:8   d: 111600.0 s
   uint8_t LONG_OFFDELAY_TIME        :8;  // 0x88.0, s:8   d: 0 s
   uint8_t LONG_OFF_TIME             :8;  // 0x89.0, s:8   d: 111600.0 s
   uint8_t LONG_ACTION_TYPE          :2;  // 0x8a.0, s:2   d: JUMP_TO_TARGET 
   uint8_t                           :3;  // 0x8a.2, s:3   d:   
   uint8_t LONG_MULTIEXECUTE         :1;  // 0x8a.5, s:1   d: ON 
   uint8_t LONG_OFF_TIME_MODE        :1;  // 0x8a.6, s:1   d: ABSOLUTE 
   uint8_t LONG_ON_TIME_MODE         :1;  // 0x8a.7, s:1   d: ABSOLUTE 
   uint8_t LONG_JT_ON                :4;  // 0x8b.0, s:4   d: OFF 
   uint8_t LONG_JT_OFF               :4;  // 0x8b.4, s:4   d: OFF 
   uint8_t LONG_JT_ONDELAY           :4;  // 0x8c.0, s:4   d: OFF 
   uint8_t LONG_JT_OFFDELAY          :4;  // 0x8c.4, s:4   d: OFF 
   uint8_t LONG_JT_RAMPON            :4;  // 0x8d.0, s:4   d: OFF 
   uint8_t LONG_JT_RAMPOFF           :4;  // 0x8d.4, s:4   d: OFF 
   uint8_t LONG_OFF_LEVEL            :8;  // 0x8f.0, s:8   d: 0.0 %
   uint8_t LONG_ON_LEVEL             :8;  // 0x91.0, s:8   d: 1.0 %
   uint8_t LONG_CT_REFON             :4;  // 0x9c.0, s:4   d: X GE COND_VALUE_LO 
   uint8_t LONG_CT_REFOFF            :4;  // 0x9c.4, s:4   d: X GE COND_VALUE_LO 
   uint8_t LONG_MAX_TIME_FIRST_DIR   :8;  // 0x9d.0, s:8   d: 0.5 s
   uint8_t LONG_JT_REFON             :4;  // 0x9e.0, s:4   d: OFF 
   uint8_t LONG_JT_REFOFF            :4;  // 0x9e.4, s:4   d: OFF 
   uint8_t LONG_DRIVING_MODE         :8;  // 0x9f.0, s:8   d: DRIVE_DIRECTLY 
}; // 38 byte

Gruß Dietmar
FB7390, CUL, 2 FHT, FS20
modules: 98_WOL.pm, 98_Heating_Control.pm,   98_WeekdayTimer.pm, 98_RandomTimer.pm, 59_Twilight.pm

papa

Cool - sieht sehr gut aus. Die Defaultwerte stehen doch auch im XML. Damit hätte man gleich das initiale Setup fertig.
BananaPi + CUL868 + CUL433 + HM-UART + 1Wire

Dietmar63

Ich erkläre mich bereit einen solchen Klassengenerator für die Regs zu bauen.
Wenn er läuft, kannst du ihn in AskSinPP einchecken.

Ich stelle mir folgenes vor. Der Code sollte komplett so(ähnlich) herauskommen. Man könnte den Code in ein eigenes File auslagern, dass müllt er nicht das *.ino so zu:

class MotionList1Data {
public:
  uint8_t EventFilterPeriod : 4;     // 0x01
  uint8_t EventFilterNumber : 4;     // 0x01
  uint8_t MinInterval       : 3;     // 0x02
  uint8_t CaptureWithinInterval : 1; // 0x02
  uint8_t BrightnessFilter  : 4;     // 0x02
  uint8_t AesActive         :1;      // 0x08, s:0, e:1
  uint8_t LedOntime;                 // 0x20

  static uint8_t getOffset(uint8_t reg) {
    switch (reg) {
      case 0x01: return 0;
      case 0x02: return 1;
      case 0x08: return 2;
      case 0x20: return 3;
      default: break;
    }
    return 0xff;
  }

  static uint8_t getRegister(uint8_t offset) {
    switch (offset) {
      case 0:  return 0x01;
      case 1:  return 0x02;
      case 2:  return 0x08;
      case 3:  return 0x20;
      default: break;
    }
    return 0xff;
  }
};

class MotionList1 : public ChannelList<MotionList1Data> {
public:
  MotionList1(uint16_t a) : ChannelList(a) {}

  uint8_t eventFilterPeriod () const { return getByte(0,0x0f,0); }
  bool eventFilterPeriod (uint8_t value) const { return setByte(0,value,0x0f,0); }
  uint8_t eventFilterNumber () const { return getByte(0,0xf0,4); }
  bool eventFilterNumber (uint8_t value) const { return setByte(0,value,0xf0,4); }

  uint8_t minInterval () const { return getByte(1,0x07,0); }
  bool minInterval (uint8_t value) const { return setByte(1,value,0x07,0); }
  bool captureWithinInterval () const { return isBitSet(1,0x08); }
  bool captureWithinInterval (bool value) const { return setBit(1,0x08,value); }
  uint8_t brightnessFilter () const { return getByte(1,0xf0,4); }
  bool brightnessFilter (uint8_t value) const { return setByte(1,value,0xf0,4); }

  bool aesActive () const { return isBitSet(2,0x01); }
  bool aesActive (bool s) const { return setBit(2,0x01,s); }

  uint8_t ledOntime () const { return getByte(3); }
  bool ledOntime (uint8_t value) const { return setByte(3,value); }

  void defaults () {
    eventFilterPeriod(1);
    eventFilterNumber(1);
    minInterval(4);
    captureWithinInterval(false);
    brightnessFilter(7);
    aesActive(false);
    ledOntime(100);
  }
};


Für den  hm-es-tx habe ich für die folgendne Felder kein xml gefunden - hat sich was am xml geändert und ich habe eine alten Stand des xml?

# ----------------------------------------------------------------------
# --- MeterList0Data
# ----------------------------------------------------------------------
class MeterList0Data : public List0Data {
  uint8_t LocalResetDisbale : 1;   // 0x18 - 24
  uint8_t Baudrate          : 8;   // 0x23 - 35
  uint8_t SerialFormat      : 8;   // 0x24 - 36
  uint8_t MeterPowerMode    : 8;   // 0x25 - 37
  uint8_t MeterProtocolMode : 8;   // 0x26 - 38
  uint8_t SamplesPerCycle   : 8;   // 0x27 - 39
Gruß Dietmar
FB7390, CUL, 2 FHT, FS20
modules: 98_WOL.pm, 98_Heating_Control.pm,   98_WeekdayTimer.pm, 98_RandomTimer.pm, 59_Twilight.pm