Aus HM-SEC-SC_WDS wird HM-PB-2-FM_ISC2

Entwicklung und Bau von Hardware aller Art, die im HM-Umfeld eingesetzt werden kann

Moderator: Co-Administratoren

Antworten
Berniie
Beiträge: 18
Registriert: 16.04.2019, 18:44

Aus HM-SEC-SC_WDS wird HM-PB-2-FM_ISC2

Beitrag von Berniie » 04.03.2023, 15:53

Dank der hervorragenden Arbeit der hier aktiven, ist es mir gelungen den HM-SEC-SC_WDS zum HM-PB-2-FM_ISC2 zu flashen.
Vielleicht ist das ja für den einen oder anderen interessant.
Würde mich freuen, wenn jemand der mehr Ahnung vom Thema hat als ich, mal über den sketch schaut.
Ich habe den Eindruck, dass der HM-PB-2-FM_ISC2 etwas viel Strom braucht. Vielleicht lässt sich da ja noch etwas optimieren.

Code: Alles auswählen

//- -----------------------------------------------------------------------------------------------------------------------
// AskSin++
// 2016-10-31 papa Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
// 2021-02-12 jp112sdl Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
// 2021-02-12 re-vo-lution 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 EI_NOTEXTERNAL
#include <EnableInterrupt.h>
#include <AskSinPP.h>
#include <LowPower.h>

#include <MultiChannelDevice.h>
#include <Remote.h>

#define LED_PIN           8
#define CONFIG_BUTTON_PIN 0
#define BTN1_PIN          A0
#define BTN2_PIN          4
#define CC1101_PWR_PIN    5

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

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

// define all device properties
const struct DeviceInfo PROGMEM devinfo = {
  {0xca, 0xfe, 0x18},     // Device ID - 01 vergeben
  "WDSRC00018",           // Device Serial - 01 vergeben
  {0x00, 0x08},           // Device Model
  0x14,                   // Firmware Version
  as::DeviceType::Remote, // Device Type
  {0x00, 0x00}            // Info Bytes
};

/**
   Configure the used hardware
*/
typedef AvrSPI<10,11,12,13> SPIType;
typedef Radio<SPIType,2, CC1101_PWR_PIN> RadioType;
typedef StatusLed<LED_PIN> LedType;
typedef AskSin<LedType, IrqInternalBatt, RadioType> Hal;

typedef RemoteChannel<Hal, PEERS_PER_CHANNEL, List0> ChannelType;
typedef MultiChannelDevice<Hal, ChannelType, 4> RemoteType;

Hal hal;
RemoteType sdev(devinfo, 0x20);
ConfigButton<RemoteType> cfgBtn(sdev);

void setup () {
  DINIT(57600, ASKSIN_PLUS_PLUS_IDENTIFIER);
  sdev.init(hal);
  hal.battery.init();
  hal.battery.low(22);
  hal.battery.critical(19);
  
  remoteISR(sdev, 1, BTN1_PIN);
  remoteISR(sdev, 2, BTN2_PIN);
  buttonISR(cfgBtn, CONFIG_BUTTON_PIN);
  
  while (hal.battery.current() == 0);

  sdev.initDone();
}

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



Antworten

Zurück zu „Hardwareentwicklung und Selbstbau von Aktoren und Sensoren“