AskSin++ Library

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

Vorheriges Thema - Nächstes Thema

Beetle2003

Zitat von: McShire am 19 August 2021, 10:56:44
Ich habe bei meiner Suche nach einer Lösung nirgendwo über den reset mit dem Konfi-button etwas gefunden oder gelesen.
Sollte man vielleicht eine Info dazu in der asksinpp.de einfügen?
Viele Grüße
Werner

Hallo Werner,

dieses gilt für alle Homematic Produkte. Konfig Taster drücken bis sich die Blinkfrequenz ändert und kurz loslassen und wieder drücken. Das setzt das Gerät in Werkszustand zurück.

Gruss

Ralf

McShire

Hallo Ralf,
danke für die Info. Das habe ich nicht gewusst.
Viele Grüße
Werner

capt_bluebaer

Hallo Leute,
ich habe 'mal 'ne Frage an die Experten.
Ich bin auf der Suche nach einer Lösung für einen 4-fach kombinierten Sensor/Aktor (HM_LC_SWX-SM / HM_SENSOR_RELAY) der sich verhält wie eine Radio-Button Funktion (so wie in Software GUI Programmierung). Soll heißen, dass z.B. Button 1 betätigt wird soll Relais 1 wie gewohnt aktivieren, gleichzeitig aber Relais 2 und 3 abfallen lassen.
Folgende Gedanken habe ich mir gemacht:
- Eine Verriegelung von Relais 2/3 ausgangsseitig durch Relais 1 scheidet aus - es gibt kein Feedback über deren Status.
- Eine RC-Kombination mit FET, die von Relais 1 für eine definierte Zeit die Eingänge 2 und 3 auf Low zieht wäre möglich.
- Eine Software-Lösung wäre mir am liebsten, entweder über Register-Einträge (ist mir allerdings nicht bekannt) oder irgendwelche Modifikationen im Source-Code.
- Ist der https://github.com/jp112sdl/HB-UNI-SenAct-4-4 von Jérôme die Lösung? Beim Peering von Button 1 mit Relais 2/3 muss aber sichergestellt sein, dass Button 1 nur bei "on" die Ausgänge 2/3 ausschaltet - also Toggle ist nicht die Lösung.
Bin gespannt auf Antworten.

Capt.
Raspi 3 Model B, nanoCUL868 (HM), signalDuino (433 MHz), jeeLink

papa

Das geht komplett mit den Peerings und richtigen Registersettings. Allerdings nur für die Buttons.
Siehe angehängten Sketch - initPeerings()
BananaPi + CUL868 + CUL433 + HM-UART + 1Wire

capt_bluebaer

Funktioniert wie es soll. Mit den gleichen Registersettings der Buttons kann man die Logik auch nach gepeerten Fernbedienungen übertragen.
In Fhem genügen zwei notifys für meine Anwendung.
Danke papa, das hat mir ein Haufen Bastelarbeit mit dem Lötkolben erspart.  :)
Raspi 3 Model B, nanoCUL868 (HM), signalDuino (433 MHz), jeeLink

McShire

Hallo papa, hallo capt_bluebaer,

ich habe mal einen Sketch für einen 2-fach Sensor/Actor auf 4 Channels erweitert.
Mit papa's Hilfe wurde der Sketch so verändert, dass man ihn nicht nur mit buttons sondern auch mit einem Schalter lokal schalten kann.
Damit kann man das Modul hinter einem Lichtschalter verwenden um parallel zum Lichtschalter das Licht auch mit FHEM fernsteuern kann.

In diese Erweiterung habe ich softwaremäßig eine Verriegelung für Relay 2 und 3 eingebaut, das die Relays ausgeschaltet werden, wenn Relay 1 geschlossen wird.
Damit erfolgt das Ausschalten der Relays sowohl wenn R1 über die lokalen buttons als auch über FHEM eingeschaltet wird und wenn sie eingeschaltet
werden sollen, während R1 eigeschaltet ist, werden sie sofort wieder ausgeschaltet, so dass die Relais (je nach Verzögerung) gar nicht erst anziehen.

Fernsteuern kann man dann einfach, indem die Fernsteuerung über notify jeweils die Relays in FHEM schaltet
Hiermit ist man nicht mehr von den buttons und vom peering abhängig. Vielleicht kannst Du es gebrauchen.

Hier der Sketch:

//- -----------------------------------------------------------------------------------------------------------------------
// AskSin++  "HM-LC-Sw4-FM-on-1-off-2-3.ino"
// Modification from AsksinPP Scetch "HM-LC-Sw2-FM.ino" (papa)
// 2016-10-31 papa Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
// 2020-11-30 McShire modification for use of a switch like a button for local change of the actor-relay
//            connect switch to pin 9 and GND
// 2021-08-30 McShire expand to 4 Channels
//            set Relay 2 / Relay 3 OFF when Relay 1 is ON
//- -----------------------------------------------------------------------------------------------------------------------

// define this to read the device id, serial and device type from bootloader section
// #define USE_OTA_BOOTLOADER

#define HM_LC_SW4_SM 0x00,0x03

#define EI_NOTEXTERNAL
#include <EnableInterrupt.h>
#include <AskSinPP.h>
#include <LowPower.h>

#include <Switch.h>

// we use a Pro Mini
// Arduino pin for the LED
// D4 == PIN 4 on Pro Mini
#define LED_PIN 4
// Arduino pin for the config button
// B0 == PIN 8 on Pro Mini
#define CONFIG_BUTTON_PIN 8

//set to 0x01 if the RELAY should be switched on LOW level
#define LOW_ACTIVE 0x00 
#define RELAY1_PIN 5    // modified from A3,
#define RELAY2_PIN 6    // modified from A2
#define RELAY3_PIN 7    // additional Channel
#define RELAY4_PIN 3    // additional Channel


#define BUTTON1_PIN 14
#define BUTTON2_PIN 15
#define BUTTON3_PIN 16
#define BUTTON4_PIN 17

#define SWITCH1_PIN 9  // inserted McShire
#define SWITCH2_PIN 18  // Pin 9 und Pin 18 connect to switch, other switch pole to ground, 18 statt 7


// number of available peers per channel
#define PEERS_PER_CHANNEL 8

// all library classes are placed in the namespace 'as'
using namespace as;

// define all device properties
const struct DeviceInfo PROGMEM devinfo = {
  {0x12, 0x09, 0x41},     // Device ID
  "JPLCSw2041",           // Device Serial
  {HM_LC_SW4_SM},           // Device Model
  0x24,                   // Firmware Version
  as::DeviceType::Switch, // Device Type
  {0x01, 0x00}            // Info Bytes
};

/**
   Configure the used hardware
*/
typedef AvrSPI<10, 11, 12, 13> RadioSPI;
typedef AskSin<StatusLed<LED_PIN>, NoBattery, Radio<RadioSPI, 2> > Hal;

// setup the device with channel type and number of channels
typedef MultiChannelDevice<Hal, SwitchChannel<Hal, PEERS_PER_CHANNEL, List0>, 4> SwitchType;

// inserted by McShire
// boolean localon = false;   // state of the Switch, true = on, false = off
boolean localon1 = false;   // state of the Switch1, true = on, false = off
boolean localon2 = false;   // state of the Switch2, true = on, false = off

Hal hal;
SwitchType sdev(devinfo, 0x20);
ConfigButton<SwitchType> cfgBtn(sdev);
InternalButton<SwitchType> btn1(sdev, 1);
InternalButton<SwitchType> btn2(sdev, 2);
InternalButton<SwitchType> btn3(sdev, 3);
InternalButton<SwitchType> btn4(sdev, 4);

void initPeerings (bool first) {
  // create internal peerings - CCU2 needs this
  if ( first == true ) {
    HMID devid;
    sdev.getDeviceID(devid);
    for ( uint8_t i = 1; i <= sdev.channels(); ++i ) {
      Peer ipeer(devid, i);
      sdev.channel(i).peer(ipeer);
    }
  }
}

void setup () {
  DINIT(57600, ASKSIN_PLUS_PLUS_IDENTIFIER);
  bool first = sdev.init(hal);
  sdev.channel(1).init(RELAY1_PIN, LOW_ACTIVE);
  sdev.channel(2).init(RELAY2_PIN, LOW_ACTIVE);
  sdev.channel(3).init(RELAY3_PIN, LOW_ACTIVE);
  sdev.channel(4).init(RELAY4_PIN, LOW_ACTIVE);

  buttonISR(cfgBtn, CONFIG_BUTTON_PIN);
  buttonISR(btn1, BUTTON1_PIN);
  buttonISR(btn2, BUTTON2_PIN);
  buttonISR(btn3, BUTTON3_PIN);
  buttonISR(btn4, BUTTON4_PIN);

pinMode(SWITCH1_PIN, INPUT_PULLUP); // inserted by McShire
pinMode(SWITCH2_PIN, INPUT_PULLUP); // inserted by McShire

  sdev.channels(4);
  initPeerings(first);
  sdev.initDone();
}

void loop() {
  bool worked = hal.runready();

  // Version v1 Modification by McShire (virual button created by papa)
if( localon1 != digitalRead(SWITCH1_PIN) ) {
  delay(50);                                   //wait because of possible switch bouncing
  localon1 = !localon1;
  btn1.shortPress();
}
if( localon2 != digitalRead(SWITCH2_PIN) ) {
  delay(50);                                   //wait because of possible switch bouncing
  localon2 = !localon2;
  btn2.shortPress();
}

  // The following block was inserted by McShire,
  // if Relay 1 on then Relay 2 and Relay 3 off
  if (digitalRead(RELAY1_PIN) == HIGH) {        // Relay 1 state is on       
     if (digitalRead(RELAY2_PIN) == HIGH)      // Relay 2 state is on
         btn2.shortPress();                    // Relay 2 is set off (toggle)
     if (digitalRead(RELAY3_PIN) == HIGH)      // Relay 3 state is on
         btn3.shortPress();                    // Relay 3 is set off (toggle)
  }
 
  bool poll = sdev.pollRadio();
  if ( worked == false && poll == false ) {
    hal.activity.savePower<Idle<> >(hal);
  }
}



Viele Grüße
Werner

pwlr

Moin in die Runde,

ich bin über den HB-LC-BL1-FM-2 (Jalousieaktor, 2 Kanäle) "gestolpert", den ich gut für meine Garagentorsteuerung benutzen kann. Um die jeweils aktuellen Aktor Positionen auch über eine Power-Off-Phase zu erhalten, habe ich mal ein FRAM mit eingebaut. Diese Justierfahrten nach PowerOn sind bei einem Garagentor mehr als nervig...
Ich gehe dabei davon aus, dass sowohl der Tormotor als auch der HB-LC-BL1-FM-2 über den selben Stromkreis versorgt werden und somit die letzte Postion im HB-LC-BL1-FM-2 auch der Realität entspricht. Ausnahmen sind Erstinstallation und ein Stromausfall während einer Torfahrt.

Aktivierung im Sketch mit :
#define use_I2C                yes                              //enable code for I2C communication
#define use_fram               yes                              //enable code for FRAM

Funktionsübersicht:
1. bei motorStop wird die aktuelle Position im FRAM gespeichert
2. bei PowerOn wir diese letzte Position aus dem FRAM gelesen und der Kanal per updateLevel richtig gesetzt.

Die zulässigen Schreibzyklen sind bei FRAM ja mehr als großzügig.

hier der Code, falls jemand Interesse hat :

//- -----------------------------------------------------------------------------------------------------------------------
// AskSin++
// 2017-12-14 papa Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
//- -----------------------------------------------------------------------------------------------------------------------

//HB-LC-Bl1-FM-2 copied from https://pastebin.com/zPf89Jir
//with some modifications by bmw

/*Doc 2 channel blind actor


see FHEM-Forum  https://forum.fhem.de/index.php/topic,102920.msg965762.html#msg965762




*/

/*Doc definition needed in     HMConfig_AskSinPPCustom.pm
# 2 channel blind actor
$HMConfig::culHmModel{"F207"} = {name=>"HB-LC-BL1-FM-2",st=>'custom',cyc=>'',rxt=>'',lst=>'1,3:1p.2p',chn=>"Blind:1:2"};
$HMConfig::culHmChanSets{"HB-LC-BL1-FM-200"}{fwUpdate} = "<filename>";
$HMConfig::culHmChanSets{"HB-LC-BL1-FM-201"} = $HMConfig::culHmSubTypeSets{"blindActuator"};
$HMConfig::culHmChanSets{"HB-LC-BL1-FM-202"} = $HMConfig::culHmSubTypeSets{"blindActuator"};
$HMConfig::culHmRegModel{"HB-LC-BL1-FM-2"}   = {};
#$HMConfig::culHmRegModel{"HB-LC-BL1-FM-2"}   = {};
$HMConfig::culHmRegChan {"HB-LC-BL1-FM-201"} = $HMConfig::culHmRegType{blindActuator};
$HMConfig::culHmRegChan {"HB-LC-BL1-FM-202"} = $HMConfig::culHmRegType{blindActuator};
$customMsg{"HB-LC-BL1-FM-2"} = sub {
  my ($msg,$target) = @_;
  return $msg->processBlindStatus($target) if $msg->isStatus;
  return ();
};

# restart FHEM after changes !!
*/

/*Doc
status bei powerOn: stop:off, pct 0, level 0
see modifications bmw to include FRAM support

Tagets :
store actual channel position in FRAM - done
include some (4) additional position sensors


*/

//modified bmw
#define no 2 //only for compilers usage
#define yes 3 //only for compilers usage
#define inoperative 0 //only for compilers usage
#define separate 9 //only for compilers usage
#define checked 8 //only for compilers usage
#define German 2 //only for compilers usage
#define English 3 //only for compilers usage

#define use_I2C yes //enable code for I2C communication
#define use_fram yes //enable code for FRAM
//modified bmw end

#define HIDE_IGNORE_MSG //do not show packet dumps of received messages
#define FHEM_MODEL "HB-LC-BL1-FM-2" //modified bmw
#define serial_number "AskSinPP1A" //modified bmw

// define this to read the device id, serial and device type from bootloader section
// #define USE_OTA_BOOTLOADER

#define EI_NOTEXTERNAL
#include <EnableInterrupt.h>
#include <AskSinPP.h>
#include <LowPower.h>

#include <Blind.h>

#if use_fram == yes //modified bmw
#define use_I2C yes //we need I2C
#endif
#if use_I2C == yes //modified bmw
#include <Wire.h> //include I2C 
//https://www.arduino.cc/en/Reference/Wire
#define I2C_STANDARD_MODE UL100000
#define I2C_FAST_MODE                        UL400000
#define I2C_FAST_MODE_PLUS_MODE             UL1000000
#define I2C_HIGH_SPEED_MODE                 UL3400000

//#define FRAM_I2C_MODES I2C_FAST_MODE_PLUS_MODE
#endif

#if use_fram == yes //modified bmw
#define fram_I2C_address 0x50 //I2C address - Doc only !

#define fram_storage_base 0x800 //storage base within FRAM
#define error_cond 220 //indicator for power lost while motion
#define fram_runtime_verbose 0
#define fram_init_verbose 0
#define fram_debug no
#include <MB85_FRAM.h> // https://github.com/Zanduino/MB85_FRAM

/* Doc Declare global variables and instantiate classes */
MB85_FRAM_Class FRAM; //Create an instance of the MB85_FRAM class

uint8_t fram_chips; //amount of memory chips ( 0 - 8)
uint8_t actual_position;
uint8_t couple_position;
#endif


// we use a Pro Mini
// Arduino pin for the LED
#define LED_PIN 4
// Arduino pin for the config button
// B0 == PIN 8 on Pro Mini
#define CONFIG_BUTTON_PIN 8

#define ON_RELAY_PIN A0    //old 14
#define DIR_RELAY_PIN A1 //old 15

#define ON_RELAY2_PIN 16
#define DIR_RELAY2_PIN 17

#define UP_BUTTON_PIN 7
#define DOWN_BUTTON_PIN 6

#define UP_BUTTON2_PIN 5
#define DOWN_BUTTON2_PIN 3

// number of available peers per channel
#define PEERS_PER_CHANNEL 6

// all library classes are placed in the namespace 'as'
using namespace as;

// define all device properties
const struct DeviceInfo PROGMEM devinfo = {
  {0x00, 0x05, 0xaf},            // Device ID
  serial_number,                  // Device Serial
  {0xF2, 0x07},                  // Device Model -> old {0x00, 0x05},
  0x24,                          // Firmware Version
  as::DeviceType::BlindActuator, // Device Type
  {0x01, 0x00}                    // Info Bytes
};

/**
   Configure the used hardware
*/
typedef AvrSPI<10, 11, 12, 13> RadioSPI;
typedef AskSin<StatusLed<LED_PIN>, NoBattery, Radio<RadioSPI, 2> > Hal;

DEFREGISTER(BlindReg0, MASTERID_REGS, DREG_INTKEY, DREG_CONFBUTTONTIME, DREG_LOCALRESETDISABLE)

class BlindList0 : public RegList0<BlindReg0> {
  public:
    BlindList0 (uint16_t addr) : RegList0<BlindReg0>(addr) {}
    void defaults () {
      clear();
      // intKeyVisible(false);
      confButtonTime(0xff);
      // localResetDisable(false);
    }
};


class BlChannel : public ActorChannel<Hal, BlindList1, BlindList3, PEERS_PER_CHANNEL, BlindList0, BlindStateMachine> {
  private:
    uint8_t on_relay_pin;
    uint8_t dir_relay_pin;
  public:
    typedef ActorChannel<Hal, BlindList1, BlindList3, PEERS_PER_CHANNEL, BlindList0, BlindStateMachine> BaseChannel;

    BlChannel () : on_relay_pin(0), dir_relay_pin(0) {}
    virtual ~BlChannel () {}

    virtual void switchState(uint8_t oldstate, uint8_t newstate, uint32_t stateDelay) {
      BaseChannel::switchState(oldstate, newstate, stateDelay);
      if ( newstate == AS_CM_JT_RAMPON && stateDelay > 0 ) {
        motorUp();
      }
      else if ( newstate == AS_CM_JT_RAMPOFF && stateDelay > 0 ) {
        motorDown();
      }
      else {
        motorStop();
      }
    }

    void motorUp () {
digitalWrite(dir_relay_pin, HIGH);
digitalWrite(on_relay_pin, HIGH);

#if use_fram == yes //modified bmw
FRAM.write((fram_storage_base + on_relay_pin), error_cond); //presave channel error condition in FRAM
#endif
    }

    void motorDown () {
digitalWrite(dir_relay_pin, LOW);
digitalWrite(on_relay_pin, HIGH);

#if use_fram == yes //modified bmw
FRAM.write((fram_storage_base + on_relay_pin), error_cond); //presave channel error condition in FRAM
#endif
    }

    void motorStop () {
digitalWrite(dir_relay_pin, LOW);
digitalWrite(on_relay_pin, LOW);
 
#if fram_debug == yes //modified bmw
DPRINT("dir_relay_pin = ");DPRINTLN(dir_relay_pin); //used pin for actual channel
DPRINT("on_relay_pin = ");DPRINTLN(on_relay_pin); //used pin for actual channel
DPRINT("stop at position = ");DPRINTLN(BaseChannel::status()); //actual position for actual channel
DPRINT("Port 15 = ");DPRINTLN(DIR_RELAY_PIN);
DPRINT("Port AO = ");DPRINTLN(ON_RELAY_PIN);
/* Result
on_relay_pin (klein geschieben !) kann als offset zu fram_storage_base verwendet werden,
um die aktuelle Position des aktuellen Kanals zu speichern
*/
#endif

#if use_fram == yes //modified bmw
if (BaseChannel::status() < 201) { //value in proper range ?
FRAM.write((fram_storage_base + on_relay_pin), BaseChannel::status()); //save actual channel position in FRAM
};
#if fram_runtime_verbose > 1
DPRINT("stop at position = ");DPRINTLN(BaseChannel::status()); //actual position
#endif
#endif
    }

    void init (uint8_t op, uint8_t dp) {
on_relay_pin = op;
dir_relay_pin = dp;
pinMode(on_relay_pin, OUTPUT);
pinMode(dir_relay_pin, OUTPUT);
//motorStop(); //modified bmw
//not necessary, initial port state is LOW
//otherwise we'll save wrong position in FRAM
//at this point
BaseChannel::init();
 
#if use_fram == yes //modified bmw
FRAM.read((fram_storage_base + on_relay_pin), actual_position); //read actual channel position from FRAM
//proper range 0 - 200
//255 => first usage of FRAM or FRAM uninstalled
//220 => error e.g. power lost while in motion
//must be sync by drive to level 100 and 0
BaseChannel::updateLevel(actual_position); //set initial channel position from FRAM

#if fram_init_verbose > 3
DPRINT("set actual position to ");DPRINTLN(actual_position);
#endif
#endif
    }
};


// setup the device with channel type and number of channels
typedef MultiChannelDevice<Hal, BlChannel, 2, BlindList0> BlindType;

Hal hal;
BlindType sdev(devinfo, 0x20);
ConfigButton<BlindType> cfgBtn(sdev);
InternalButton<BlindType> btnup(sdev, 1);
InternalButton<BlindType> btndown(sdev, 2);
InternalButton<BlindType> btnup2(sdev, 3);
InternalButton<BlindType> btndown2(sdev, 4);

void initPeerings (bool first) {
  // create internal peerings - CCU2 needs this
  if ( first == true ) {
    HMID devid;
    sdev.getDeviceID(devid);
    Peer p1(devid, 1);
    Peer p2(devid, 2);
    Peer p3(devid, 3);
    Peer p4(devid, 4);
    sdev.channel(1).peer(p1, p2);
    sdev.channel(2).peer(p3, p4);
  }
}

void setup () {
  //DINIT(57600, ASKSIN_PLUS_PLUS_IDENTIFIER); //modified bmw
  DINIT(57600, FHEM_MODEL); //modified bmw
  DPRINTLN(serial_number); //modified bmw
 
  //storage().setByte(0,0);
 
  #if use_I2C == yes //modified bmw
Wire.begin();
#endif

#if use_fram == yes //modified bmw
fram_chips = FRAM.begin(I2C_FAST_MODE_PLUS_MODE); //begin and return amount of installed memory chips
if(fram_chips == 0) {
#if fram_init_verbose > -1
DPRINTLN("found no FRAM-Chips");
#endif
} else {
#if fram_init_verbose > 1
DPRINT("support for ");DPRINT(fram_chips);DPRINTLN(" FRAM-Chips included");
DPRINT("total FRAM-Storage = ");DPRINTLN(FRAM.totalBytes());
#endif
};
#endif
 
 
  bool first = sdev.init(hal);
  sdev.channel(1).init(ON_RELAY_PIN, DIR_RELAY_PIN);
  sdev.channel(2).init(ON_RELAY2_PIN, DIR_RELAY2_PIN);

  buttonISR(cfgBtn, CONFIG_BUTTON_PIN);
  buttonISR(btnup, UP_BUTTON_PIN);
  buttonISR(btndown, DOWN_BUTTON_PIN);
  buttonISR(btnup2, UP_BUTTON2_PIN);
  buttonISR(btndown2, DOWN_BUTTON2_PIN);

  initPeerings(first);
  sdev.initDone();
}

void loop() {

  bool worked = hal.runready();
  bool poll = sdev.pollRadio();
  if ( worked == false && poll == false ) {
    hal.activity.savePower<Idle<> >(hal);
  }
}



Als weitere Ergänzung benötige ich in diesem Device neben den 2 Blindchannels aber idealerweise noch 4 zusätzliche Sensorkanäle (open/close) und da komme ich mit meinen Kenntnissen überhaupt nicht weiter.  :'(
Ich brauche die, um Tor auf - Tor zu - Schlupftür auf - Tor mechanisch verriegelt anzuzeigen und auch um die Funktion zu steuern.

Könnte mir bitte jemand helfen ?

Moin und viele Grüße !
Bernd

papa

Schau Dir mal das folgende Beispiel an.
https://github.com/pa-pa/AskSinPP/blob/62faa59d718c23e3831a6ddfa93401a89e272200/examples/custom/HB-SW2-SENS/HB-SW2-SENS.ino#L76
Da werden 2 SwitchChannel und ein SensorChannel in einem Device verwendet. Dazu sind die Channel in einen VirtualChannel einzubetten. Du müsstest das dann mit den 2 BlindChannel und 4 TwoStateChannel machen. Allerdings vermute ich, dass der Speicher des 328 zu knapp werden könnte.
BananaPi + CUL868 + CUL433 + HM-UART + 1Wire

pwlr

Hi papa,

danke für Deine schnelle Antwort. Werde ich versuchen.
ZitatSchau Dir mal das folgende Beispiel an.
https://github.com/pa-pa/AskSinPP/blob/62faa59d718c23e3831a6ddfa93401a89e272200/examples/custom/HB-SW2-SENS/HB-SW2-SENS.ino#L76
Da werden 2 SwitchChannel und ein SensorChannel in einem Device verwendet. Dazu sind die Channel in einen VirtualChannel einzubetten.

Ich habe im ersten Schritt schon mal die Sensoren auf 4 erhöht und auch die Änderungen in der HMConfigAskSinPPCustom.pm gemacht. Das sieht im FHEM schon mal gut aus, die Sensoren muss ich noch testen.

Der Rest
ZitatDu müsstest das dann mit den 2 BlindChannel und 4 TwoStateChannel machen.
ist für mich deutlich schwieriger, weil ich bei den Class-Definitionen relativ schnell "den Wald vor lauter Bäumen nicht mehr sehe" und Zuordnungsschwierigkeiten habe. Bin leider nicht der C++ Profi, sondern im Lernmodus.

Mal sehen, ich mache morgen weiter...

Moin
Bernd



pwlr

Moin papa,

ok, der nächste Schritt. Wieder beginnend mit dem Original-Sketch habe ich die beiden Switche rausgenommen und die HMConfigAskSinPPCustom.pm angepaßt. Im Ergebnis habe ich ein funtionierendes Device mit nur 1 Sensor-Channel bekommen. Das macht Mut...

Beim Versuch darin jetzt 1 BlindChannel einzubauen, bin ich kläglich gescheitert. Ich bin davon ausgegangen, dass ich "nur" die Kanaldefinitionen (Blind) in das vorhandene Mixdevice integrieren muss. Aber meine Analyse, was nun Kanaldefinition und was Devicedefinition ist, ist wohl nicht so ganz richtig. Copy-Basis für den Blind ist die HM-LC-Bl1-FM

https://github.com/pa-pa/AskSinPP/blob/master/examples/HM-LC-Bl1-FM/HM-LC-Bl1-FM.ino

Jedenfalls steh ich auf dem Schlauch und komme nicht weiter. :'(

Könntest Du bitte mal einen Blick auf den Code werfen und mir einen Tipp geben ?

//- -----------------------------------------------------------------------------------------------------------------------
// AskSin++
// 2017-10-24 papa Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
// ci-test=yes board=328p aes=no
//- -----------------------------------------------------------------------------------------------------------------------

// define this to read the device id, serial and device type from bootloader section
//#define USE_OTA_BOOTLOADER
//#define NDEBUG

//copied from https://github.com/pa-pa/AskSinPP/blob/master/examples/custom/HB-SW2-SENS/HB-SW2-SENS.ino

/* HMConfigCustom_bmw.pm
#defined from F911 with modifications

$HMConfig::culHmModel{"F912"} = {name=>"HB-SW3-SENS",st=>'custom',cyc=>'',rxt=>'',lst=>'1,3:1p.2p,4:3p',chn=>"Blind:1:1,Sen:2:2"};
$HMConfig::culHmRegModel{"HB-SW3-SENS"}   = { intKeyVisib=>1, cyclicInfoMsg=>1, sabotageMsg=>1 };
$HMConfig::culHmChanSets{"HB-SW3-SENS00"}{fwUpdate} = "<filename>";
$HMConfig::culHmChanSets{"HB-SW3-SENS01"} = $HMConfig::culHmSubTypeSets{"blindActuator"};
#$HMConfig::culHmChanSets{"HB-SW3-SENS02"} = $HMConfig::culHmSubTypeSets{"switch"};
$HMConfig::culHmChanSets{"HB-SW3-SENS02"} = $HMConfig::culHmSubTypeSets{"THSensor"};
#$HMConfig::culHmChanSets{"HB-SW3-SENS04"} = $HMConfig::culHmSubTypeSets{"THSensor"};
#$HMConfig::culHmChanSets{"HB-SW3-SENS05"} = $HMConfig::culHmSubTypeSets{"THSensor"};
#$HMConfig::culHmChanSets{"HB-SW3-SENS06"} = $HMConfig::culHmSubTypeSets{"THSensor"};
$HMConfig::culHmRegChan {"HB-SW3-SENS01"} = $HMConfig::culHmRegType{blindActuator};
#$HMConfig::culHmRegChan {"HB-SW3-SENS02"} = $HMConfig::culHmRegType{switch};
$HMConfig::culHmRegChan {"HB-SW3-SENS02"} = $HMConfig::culHmRegType{threeStateSensor};
#$HMConfig::culHmRegChan {"HB-SW3-SENS04"} = $HMConfig::culHmRegType{threeStateSensor};
#$HMConfig::culHmRegChan {"HB-SW3-SENS05"} = $HMConfig::culHmRegType{threeStateSensor};
#$HMConfig::culHmRegChan {"HB-SW3-SENS06"} = $HMConfig::culHmRegType{threeStateSensor};
$customMsg{"HB-SW3-SENS"} = sub {
  my ($msg,$target) = @_;
  my $channel = $msg->channel;
  #return $msg->processThreeState($target) if $channel == 3;
  return $msg->processThreeState($target) if $channel == 2;
  return $msg->processSwitchStatus($target) if $msg->isStatus;
  return ();
};





*/


/*trying to include blindchannel

Forum https://forum.fhem.de/index.php/topic,57486.1560.html
Da werden 2 SwitchChannel und ein SensorChannel in einem Device verwendet.
Dazu sind die Channel in einen VirtualChannel einzubetten.

Du müsstest das dann mit den 2 BlindChannel und 4 TwoStateChannel machen.

Step 1
alle switche raus, nur noch ein Mixdevice mit einem SensorChannel
Model F911 HMConfigCustom_bmw.pm angepasst

=> funktioniert !
SENS1_PIN => open   / closed
SENS2_PIN => tiltet / closed

Step 2
BlindChannel einbauen von HB-LC-Bl1-FM-2
Model F912 HMConfigCustom_bmw.pm angepasst

*/


#define EI_NOTEXTERNAL
#include <EnableInterrupt.h>
#include <AskSinPP.h>
#include <LowPower.h>

//switch raus -  #include <Switch.h>
#include <Blind.h> //added bmw
#include <ThreeState.h>

#define CONFIG_BUTTON_PIN 8
#define LED_PIN           4

//switch raus -  #define RELAY1_PIN 17
//switch raus -  #define RELAY2_PIN 16

#define SENS1_PIN A1 //old 6
#define SENS2_PIN A3 //old 3

#define ON_RELAY_PIN A0    //old 14
#define DIR_RELAY_PIN A2 //old 15

#define ON_RELAY2_PIN 16
#define DIR_RELAY2_PIN 17

#define UP_BUTTON_PIN 7
#define DOWN_BUTTON_PIN 6

#define UP_BUTTON2_PIN 5
#define DOWN_BUTTON2_PIN 3
// number of available peers per channel
#define PEERS_PER_CHANNEL 6

// number of available peers per channel

//switch raus -  #define PEERS_PER_SWCHANNEL  6
#define PEERS_PER_SENSCHANNEL 10

// all library classes are placed in the namespace 'as'
using namespace as;

// define all device properties
const struct DeviceInfo PROGMEM devinfo = {
    {0x63,0xF9,0x12},       // Device ID //modified bmw
    "HBSwSen003",           // Device Serial //modified bmw
    {0xf9,0x12},            // Device Model //modified bmw
    0x01,                   // Firmware Version
    //bmw changed -  as::DeviceType::Switch, // Device Type
    //as::DeviceType::BlindActuator,
as::DeviceType::Switch,
{0x01,0x00}             // Info Bytes
};

// Configure the used hardware
typedef AvrSPI<10,11,12,13> RadioSPI;
typedef AskSin<StatusLed<LED_PIN>,NoBattery,Radio<RadioSPI,2> > Hal;

Hal hal;

DEFREGISTER(Reg0,DREG_INTKEY,DREG_CYCLICINFOMSG,MASTERID_REGS)
class SwSensList0 : public RegList0<Reg0> {
public:
  SwSensList0(uint16_t addr) : RegList0<Reg0>(addr) {}
};

DEFREGISTER(Reg1,CREG_AES_ACTIVE,CREG_MSGFORPOS,CREG_EVENTDELAYTIME,CREG_LEDONTIME,CREG_TRANSMITTRYMAX)
class SensList1 : public RegList1<Reg1> {
public:
  SensList1 (uint16_t addr) : RegList1<Reg1>(addr) {}
  void defaults () {
    clear();
    msgForPosA(1); // CLOSED
    msgForPosB(2); // OPEN
    msgForPosC(3); // TILTED
    // aesActive(false);
    // eventDelaytime(0);
    ledOntime(100);
    transmitTryMax(6);
  }
};

DEFREGISTER(BlindReg0,MASTERID_REGS,DREG_INTKEY,DREG_CONFBUTTONTIME,DREG_LOCALRESETDISABLE)
class BlindList0 : public RegList0<BlindReg0> {
public:
  BlindList0 (uint16_t addr) : RegList0<BlindReg0>(addr) {}
  void defaults () {
    clear();
    // intKeyVisible(false);
    confButtonTime(0xff);
    // localResetDisable(false);
  }
};

class BlChannel : public ActorChannel<Hal,BlindList1,BlindList3,PEERS_PER_CHANNEL,BlindList0,BlindStateMachine> {
public:
  //nach oben geschoben, richtig ??  - typedef ActorChannel<Hal,BlindList1,BlindList3,PEERS_PER_CHANNEL,BlindList0,BlindStateMachine> BaseChannel;

  BlChannel () {}
  virtual ~BlChannel () {}

  virtual void switchState(uint8_t oldstate,uint8_t newstate, uint32_t stateDelay) {
    BaseChannel::switchState(oldstate, newstate, stateDelay);
    if( newstate == AS_CM_JT_RAMPON && stateDelay > 0 ) {
      motorUp();
    }
    else if( newstate == AS_CM_JT_RAMPOFF && stateDelay > 0 ) {
      motorDown();
    }
    else {
      motorStop();
    }
  }

  void motorUp () {
    digitalWrite(DIR_RELAY_PIN,HIGH);
    digitalWrite(ON_RELAY_PIN,HIGH);
  }

  void motorDown () {
    digitalWrite(DIR_RELAY_PIN,LOW);
    digitalWrite(ON_RELAY_PIN,HIGH);
  }

  void motorStop () {
    digitalWrite(DIR_RELAY_PIN,LOW);
    digitalWrite(ON_RELAY_PIN,LOW);
  }

  void init () {
    pinMode(ON_RELAY_PIN,OUTPUT);
    pinMode(DIR_RELAY_PIN,OUTPUT);
   
motorStop();
    BaseChannel::init();
  }
};

//switch raus -  typedef SwitchChannel<Hal,PEERS_PER_SWCHANNEL,SwSensList0>  SwChannel;
typedef ActorChannel<Hal,BlindList1,BlindList3,PEERS_PER_CHANNEL,BlindList0,BlindStateMachine> BaseChannel;
typedef ThreeStateChannel<Hal,SwSensList0,SensList1,DefList4,PEERS_PER_SENSCHANNEL> SensChannel;


//bmw changed - class MixDevice : public ChannelDevice<Hal,VirtBaseChannel<Hal,SwSensList0>,3,SwSensList0> {
class MixDevice : public ChannelDevice<Hal,VirtBaseChannel<Hal,SwSensList0>,2,SwSensList0> {
#define CYCLETIME seconds2ticks(60UL*60*24) // at least one message per day
class CycleInfoAlarm : public Alarm {
  MixDevice& dev;
public:
  CycleInfoAlarm (MixDevice& d) : Alarm (CYCLETIME), dev(d) {}
  virtual ~CycleInfoAlarm () {}

  void trigger (AlarmClock& clock)  {
    set(CYCLETIME);
    clock.add(*this);
    dev.sensorChannel().changed(true); // force StatusInfoMessage to central
  }
} cycle;

public:
  //switch raus -  VirtChannel<Hal,SwChannel,SwSensList0> c1,c2;
  //bmw changed - VirtChannel<Hal,SensChannel,SwSensList0> c3;
  VirtChannel<Hal,BaseChannel,BlindList1> c1;
  VirtChannel<Hal,SensChannel,SwSensList0> c2;
public:
  //bmw changed - typedef ChannelDevice<Hal,VirtBaseChannel<Hal,SwSensList0>,3,SwSensList0> DeviceType;
  typedef ChannelDevice<Hal,VirtBaseChannel<Hal,SwSensList0>,2,SwSensList0> DeviceType; //Anzahl Kanäle = 2
  MixDevice (const DeviceInfo& info,uint16_t addr) : DeviceType(info,addr), cycle(*this) {
    //switch raus -  DeviceType::registerChannel(c1,1);
    //switch raus -  DeviceType::registerChannel(c2,2);
    //bmw changed - DeviceType::registerChannel(c3,3);
DeviceType::registerChannel(c1,1);
DeviceType::registerChannel(c2,1);
  }
  virtual ~MixDevice () {}

  //switch raus -  SwChannel& switch1Channel ()  { return c1; }
  //switch raus -  SwChannel& switch2Channel ()  { return c2; }
  //bmw changed -  SensChannel& sensorChannel () { return c3; }
  BaseChannel& channel(1) ()  { return c1; }                        //das muss der blindchannel werden, aber wie ???

  SensChannel& sensorChannel () { return c2; }

  virtual void configChanged () {
    if( /*this->getList0().cycleInfoMsg() ==*/ true ) {
      DPRINTLN("Activate Cycle Msg");
      sysclock.cancel(cycle);
      cycle.set(CYCLETIME);
      sysclock.add(cycle);
    }
    else {
      DPRINTLN("Deactivate Cycle Msg");
      sysclock.cancel(cycle);
    }
  }
};
MixDevice sdev(devinfo,0x20);
ConfigButton<MixDevice> cfgBtn(sdev);
InternalButton<BlindType> btnup(sdev,1);
InternalButton<BlindType> btndown(sdev,2);

void initPeerings (bool first) {
  // create internal peerings - CCU2 needs this
  if( first == true ) {
    sdev.channel(1).peer(btnup.peer(),btndown.peer());
  }
}


void setup () {
  //DINIT(57600,ASKSIN_PLUS_PLUS_IDENTIFIER); //changed bmw
  DINIT(57600,"Test to include Blindchannel"); //changed bmw
  sdev.init(hal);
  //switch raus -  sdev.switch1Channel().init(RELAY1_PIN);
  //switch raus -  sdev.switch2Channel().init(RELAY2_PIN);
  sdev.channel(1).init(ON_RELAY_PIN, DIR_RELAY_PIN);
  sdev.sensorChannel().init(SENS1_PIN,SENS2_PIN);
  buttonISR(cfgBtn,CONFIG_BUTTON_PIN);
  sdev.initDone();
}

void loop() {
  bool worked = hal.runready();
  bool poll = sdev.pollRadio();
  if( worked == false && poll == false ) {
    hal.activity.savePower<Idle<> >(hal);
  }
}



und hier die Fehlermeldungen vom IDE

Arduino: 1.8.13 (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328P (3.3V, 8 MHz)"

D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino: In member function 'virtual void BlChannel::switchState(uint8_t, uint8_t, uint32_t)':

HB-SW2-SENS:170:18: error: 'switchState' is not a member of 'as::ActorChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, 6, BlindList0, as::BlindStateMachine>::BaseChannel {aka as::Channel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, as::EmptyList, 6, BlindList0, as::EmptyList>}'

     BaseChannel::switchState(oldstate, newstate, stateDelay);

                  ^~~~~~~~~~~

D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino: In member function 'void BlChannel::init()':

HB-SW2-SENS:202:18: error: 'init' is not a member of 'as::ActorChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, 6, BlindList0, as::BlindStateMachine>::BaseChannel {aka as::Channel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, as::EmptyList, 6, BlindList0, as::EmptyList>}'

     BaseChannel::init();

                  ^~~~

D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino: At global scope:

HB-SW2-SENS:247:16: error: expected ';' at end of member declaration

   BaseChannel& channel(1) ()  { return c1; }                        //das muss der blindchannel werden, aber wie ???

                ^~~~~~~

HB-SW2-SENS:247:24: error: expected unqualified-id before numeric constant

   BaseChannel& channel(1) ()  { return c1; }                        //das muss der blindchannel werden, aber wie ???

                        ^

HB-SW2-SENS:247:24: error: expected ')' before numeric constant

D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino: In constructor 'MixDevice::MixDevice(const as::DeviceInfo&, uint16_t)':

HB-SW2-SENS:239:34: error: no matching function for call to 'MixDevice::registerChannel(as::VirtChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::ActorChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, 6, BlindList0, as::BlindStateMachine>, as::BlindList1>&, int)'

  DeviceType::registerChannel(c1,1);

                                  ^

In file included from D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-master/Blind.h:9:0,

                 from D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino:76:

D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-master/MultiChannelDevice.h:43:8: note: candidate: void as::ChannelDevice<HalType, ChannelType, ChannelCount, List0Type>::registerChannel(ChannelType&, uint8_t) [with HalType = as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >; ChannelType = as::VirtBaseChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, SwSensList0>; int ChannelCount = 2; List0Type = SwSensList0; uint8_t = unsigned char]

   void registerChannel(ChannelType& ch,uint8_t num) {

        ^~~~~~~~~~~~~~~

D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-master/MultiChannelDevice.h:43:8: note:   no known conversion for argument 1 from 'as::VirtChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::ActorChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, 6, BlindList0, as::BlindStateMachine>, as::BlindList1>' to 'as::VirtBaseChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, SwSensList0>&'

D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino: At global scope:

HB-SW2-SENS:266:16: error: 'BlindType' was not declared in this scope

InternalButton<BlindType> btnup(sdev,1);

                ^~~~~~~~~

D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino:266:16: note: suggested alternative: 'BlindReg0'

InternalButton<BlindType> btnup(sdev,1);

                ^~~~~~~~~

                BlindReg0

HB-SW2-SENS:266:25: error: template argument 1 is invalid

InternalButton<BlindType> btnup(sdev,1);

                         ^

HB-SW2-SENS:267:16: error: 'BlindType' was not declared in this scope

InternalButton<BlindType> btndown(sdev,2);

                ^~~~~~~~~

D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino:267:16: note: suggested alternative: 'BlindReg0'

InternalButton<BlindType> btndown(sdev,2);

                ^~~~~~~~~

                BlindReg0

HB-SW2-SENS:267:25: error: template argument 1 is invalid

InternalButton<BlindType> btndown(sdev,2);

                         ^

D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino: In function 'void initPeerings(bool)':

HB-SW2-SENS:272:19: error: no match for call to '(BaseChannel {aka as::ActorChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, 6, BlindList0, as::BlindStateMachine>}) (int)'

     sdev.channel(1).peer(btnup.peer(),btndown.peer());

                   ^

HB-SW2-SENS:272:32: error: request for member 'peer' in 'btnup', which is of non-class type 'int'

     sdev.channel(1).peer(btnup.peer(),btndown.peer());

                                ^~~~

HB-SW2-SENS:272:47: error: request for member 'peer' in 'btndown', which is of non-class type 'int'

     sdev.channel(1).peer(btnup.peer(),btndown.peer());

                                               ^~~~

D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino: In function 'void setup()':

HB-SW2-SENS:283:17: error: no match for call to '(BaseChannel {aka as::ActorChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, 6, BlindList0, as::BlindStateMachine>}) (int)'

   sdev.channel(1).init(ON_RELAY_PIN, DIR_RELAY_PIN);

                 ^

In file included from D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-master/Device.h:12:0,

                 from D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-master/MultiChannelDevice.h:9,

                 from D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-master/Blind.h:9,

                 from D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino:76:

D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-master/Channel.h: In instantiation of 'void as::VirtChannel<HalType, ChannelType, List0Type>::setup(as::Device<HalType, List0Type>*, uint8_t, uint16_t) [with HalType = as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >; ChannelType = as::ActorChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, 6, BlindList0, as::BlindStateMachine>; List0Type = as::BlindList1; uint8_t = unsigned char; uint16_t = unsigned int]':

D:\Arduino\IDE\Sketchbook\AskSin\HB-SW2-SENS\HB-SW2-SENS.ino:295:1:   required from here

D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-master/Channel.h:415:85: error: no matching function for call to 'as::ActorChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, 6, BlindList0, as::BlindStateMachine>::setup(as::Device<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1>*&, uint8_t&, uint16_t&)'

   virtual void setup(Device<HalType,List0Type>* dev,uint8_t number,uint16_t addr) { ch.setup(dev,number,addr); }

                                                                                     ^~

D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-master/Channel.h:285:8: note: candidate: void as::ActorChannel<HalType, List1Type, List3Type, PeerCount, List0Type, StateMachine, List2Type>::setup(as::Device<HalType, List0Type>*, uint8_t, uint16_t) [with HalType = as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >; List1Type = as::BlindList1; List3Type = as::BlindList3; int PeerCount = 6; List0Type = BlindList0; StateMachine = as::BlindStateMachine; List2Type = as::EmptyList; uint8_t = unsigned char; uint16_t = unsigned int]

   void setup(Device<HalType,List0Type>* dev,uint8_t number,uint16_t addr) {

        ^~~~~

D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-master/Channel.h:285:8: note:   no known conversion for argument 1 from 'as::Device<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1>*' to 'as::Device<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, BlindList0>*'

Mehrere Bibliotheken wurden für "AskSinPP.h" gefunden

Benutzt: D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-master

Nicht benutzt: D:\Arduino\IDE\Sketchbook\libraries\AskSinPP-V4

exit status 1

'switchState' is not a member of 'as::ActorChannel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, 6, BlindList0, as::BlindStateMachine>::BaseChannel {aka as::Channel<as::AskSin<as::StatusLed<4>, as::NoBattery, as::Radio<as::AvrSPI<10, 11, 12, 13>, 2> >, as::BlindList1, as::BlindList3, as::EmptyList, 6, BlindList0, as::EmptyList>}'

Dieser Bericht wäre detaillierter, wenn die Option
"Ausführliche Ausgabe während der Kompilierung"
in Datei -> Voreinstellungen aktiviert wäre.


Ich sehe nicht die Fehler, die zu diesen Meldungen führen.

Moin
Bernd




Horti


tndx

Ich versuche gerade diesen Sketch zu kompilieren:

https://github.com/jp112sdl/Beispiel_AskSinPP/blob/master/examples/RWE/HM-RC-8_BRC8/HM-RC-8_BRC8.ino

Ohne Änderungen läuft alles problemlos. Versuche ich allerdings AES zu aktivieren mit

#define USE_AES
#define HM_DEF_KEY <...>
#define HM_DEF_KEY_INDEX 0


so ist die hex-Datei identisch zu der ohne AES. Auch die Deaktivierung des Defines "SENSOR_ONLY" ändert nichts an diesem Verhalten.

Muss ich noch irgendwas ändern?

papa

Zitat von: tndx am 03 Oktober 2021, 14:40:47

Ohne Änderungen läuft alles problemlos. Versuche ich allerdings AES zu aktivieren mit

#define USE_AES
#define HM_DEF_KEY <...>
#define HM_DEF_KEY_INDEX 0


so ist die hex-Datei identisch zu der ohne AES. Auch die Deaktivierung des Defines "SENSOR_ONLY" ändert nichts an diesem Verhalten.

Muss ich noch irgendwas ändern?
Wo sind die Defines ? Sie müssen ganz oben stehen.
BananaPi + CUL868 + CUL433 + HM-UART + 1Wire

tndx

Zitat von: papa am 03 Oktober 2021, 23:30:26
Wo sind die Defines ? Sie müssen ganz oben stehen.

Ganz oben heisst wohl, bevor AskSinPP.h eingebunden wird?

So funktioniert das jedenfalls, vielen Dank!

pwlr

Moin,

ich habe mal eine Frage zur AskSinPP.h
In der class AskSinBase (provides basic methods for general use) gibt es die sub readPin, die offensichtlich für Input-Services genutzt wird. Dort wird bei jedem Aufruf der Portmode
zunächst auf INPUT_PULLUP gesetzt,
dann der Input gelesen
und anschließend der Portmode auf OUTPUT und der Port auf LOW gesetzt.

Somit wechselt der Port ständig von einem hochohmigen in einen niederohmigen Zustand.
Mein Problem: Ich will eine Lichtschranke als Sensor anschließen, die Vcc als Signal liefert durch diesen Programmablauf nun laufend kurzgeschlossen wird. Keine Ahnung, wie lange dass die Lichtschranke und der Mini wohl aushalten werden...

Meine Frage: welchem Zweck dient dieses temporäre Umsetzen eines Input-Ports auf Output ?
Da ja außerdem noch eine Steuerungsmöglichkeit der externen Hardware über einen zweiten Port vorgesehen ist - könnte/sollte man nicht den "Kuzschluss" mit dieser Steuerung kombinieren, um so einen eindeutigen Input-Service zu erhalten ?

Ein Lösungsvorschlag aus meiner wirklich sehr eingeschränkten Sicht:


....
//pinMode(pinnr,OUTPUT);
        //digitalWrite(pinnr,LOW);

    if( enablenr != 0 && enablenr != 0xff) {
      digitalWrite(enablenr,LOW);
 
      pinMode(pinnr,OUTPUT);
      digitalWrite(pinnr,LOW);
 
 
    }
...


Bitte, ich bräuchte Eure Hilfe, um mit meinem Projekt voranzukommen.
Moin
Bernd