Code Monkey home page Code Monkey logo

ogm-common's Introduction

OpenKNX Common

OpenKNX Common is a library meant to be used once in every OpenKNX Device firmware.

The main functions are:

  • setup and calling the knx stack
  • setup and calling of the OpenKNX Modules
  • flash handling for persistent data of the OpenKNX Modules

Usage

It is designed for usage with the headerfile generated by OpenKNXproducer, which provides the necessary defines in knxprod.h:

MAIN_OpenKnxId
MAIN_ApplicationNumber
MAIN_ApplicationVersion

# optional (delivered by OAM-LogicModule)
LOG_StartupDelayBase
ParamLOG_StartupDelayTimeMS
LOG_HeartbeatDelayBase
KoLOG_Heartbeat
ParamLOG_HeartbeatDelayTimeMS

Hardware

ARCH info
RP2040 the reference platform with full support (including dual core support)
SAMD21 obsolete but still supported. no hw should be developed on this anymore
ESP32 experimental

To configure the Hardware-Setup use the following defines in hardware.h

SAVE_INTERRUPT_PIN
INFO_LED_PIN
PROG_BUTTON_PIN
PROG_LED_PIN_ACTIVE_ON
PROG_LED_PIN
KNX_UART_RX_PIN
KNX_UART_TX_PIN

Configuration

define default unit function
OPENKNX_RECOVERY_TIME 6000 ms hold prog button to erase knx and openknx data (not firmware or filesystem). Turn off with 0
OPENKNX_DUALCORE build with dualcore support (only on RP2040)
OPENKNX_WATCHDOG compile with watchdog (use only for releases. debugger not working with active watchdog)
OPENKNX_WATCHDOG_MAX_PERIOD 16384 ms the timeout period of watchdog
OPENKNX_NO_BOOT_PULSATING Turn off the pulsating LED during the boot phase. (Only necessary for specific hardware where the LED cannot be controlled via PWM).
OPENKNX_MAX_MODULES 9
OPENKNX_LEDEFFECT_PULSE_FREQ 1000 ms
OPENKNX_LEDEFFECT_BLINK_FREQ 1000 ms
OPENKNX_WAIT_FOR_SERIAL 2000 ms wait at startup until SERIAL_DEBUG is connected.
(optional with timeout - in devmode use high values like 20000 - 0 will disable waiting)
Not supported on ESP32
OPENKNX_HEARTBEAT 1000 ms enable heartbeat mode (optional with with specific failure time)
OPENKNX_HEARTBEAT_PRIO 3000 ms enable heartbeat prio mode (optional with with specific failure time)
OPENKNX_HEARTBEAT_FREQ 200 ms
OPENKNX_HEARTBEAT_PRIO_ON_FREQ 200 ms
OPENKNX_HEARTBEAT_PRIO_OFF_FREQ 1000 ms
OPENKNX_MAX_LOOPTIME 4000 µs how much time is the loop allowed to consume. (soft limit)
OPENKNX_LOOPTIME_WARNING 7 ms issue a warning if the loop has lasted X ms or longer longer.
OPENKNX_LOOPTIME_WARNING_INTERVAL 1000 ms how often the warning may be issued in the console
OPENKNX_RUNTIME_STAT Integrate Collection of Runtime-Statistics for core0.
OPENKNX_RUNTIME_STAT_BUCKETN 16 the number of histogram buckets for Runtime-Statistics
OPENKNX_RUNTIME_STAT_BUCKETS default set µs The upper (included) limits of histogram bucket, without last bucket as this will be limited by data-type only. Must be a comma-separated list with OPENKNX_RUNTIME_STAT_BUCKETN-1 entries
OPENKNX_DEBUG Enable debug mode
OPENKNX_TRACE1..5 Enable debug mode + tracing. to see trace logs, they must match one of the 5 regex filters.
OPENKNX_RTT Enable RTT Mode (Disable USB Serial output) + Increase BUFFER_SIZE_UP to 10240!
BUFFER_SIZE_UP 1024 Bytes Using by Segger RTT

Heartbeat (Mode: Normal)

You can enable a debug heartbeat to see if a loop is stuck. The progLed (for loop) and infoLed (for loop1) will blinking if the loop hangs.

Heartbeat (Mode: Prio)

In the prio mode the leds blinking (OPENKNX_HEARTBEAT_PRIO_OFF_FREQ) and stop as soon as the relevant loop hangs. If programing mode is active, the progLed will blink faster (OPENKNX_HEARTBEAT_PRIO_ON_FREQ).

So, if the device is NOT blinking, anything is wrong.

ogm-common's People

Contributors

traxanos avatar cornelius-koepp avatar ing-dom avatar geminiserver avatar thewhobox avatar waldemarporscha avatar ginkel avatar mumpf avatar

Stargazers

 avatar  avatar  avatar Robert avatar

Watchers

 avatar  avatar Robert avatar  avatar  avatar  avatar  avatar

ogm-common's Issues

add loop time statistics

gather statistics for the loop time - average, min, max, % and/or cnt that exceed some level, etc. pp.
maybe do that per module or at least seperate for knx stack ?

One potential risk found in the function Hardware::validateResponse in the file Hardware.cpp

Thank you guys for creating and continuing contributing the outstanding OpenKNX repos. It does give me the chance to learn about the details behind KNX device (hardware and software). Hopefully I could make some contributions here.

After reviewing, there is one potential risk found in the function Hardware::validateResponse in the file OGM-Common\src\OpenKNX\Hardware.cpp in the branch modular. This potential risk may result in the false validation response. It will be great if you could consider to correct it.
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.