logo elektroda
logo elektroda
X
logo elektroda

How to Track and Assign Unused Channels for DS1820 Temperature Sensors in Config Files

max4elektroda 603 2
ADVERTISEMENT
  • #1 21621179
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    I recently came to the point where I wanted to find out, which channels are "in use" in order to avoid assigning an already used channel to DS1820 for temperature.

    It reminded me about my approach to center pinrole and channels, actually spread over different files in one.
    This is updated and actual work can be found here: in this branch

    Basic idea:
    There is one new text file with all information
    An awk script will generate an header file included by multiple files to replace the information prior coded there.

    It won't break anything, saves some bytes but "uglifies" JavaScript code a bit.
    And not yet done: I need to figure out/check automatic build of documentation (since the information will be in another file now).

    I also included a new #define to have the possibility to change the GUI
    Inspired by an idea of @divadiow I tried to extend the page for "Configure Module" to add a "description" for the channels.
    Adding the descriptions is quite straightforward; since adds some information to the image it will increase size a bit.

    Here's a preview of the actual possible work the following changes to the actual page (its enabled for the windows simulator to test):

    Removed channels from "0 channel" roles
    Hide pins with no role assignment
    Added simple "function" to channels

    Pin configuration page with three pins assigned roles and channels
    Dropdown list with pin configuration options and assigned roles.

    Just actual work to see what is possible...




    So: Why this post? Its not really about the changes above, but a related question:


    But then I realized we have quite some different approaches for handling of
    Pins, roles, channels and drivers.

    We have drivers which are configured through the "Configure Module" page:
    - setting the role for the pin and possibly the channels
    - this has two possible results:
    - you can start the driver via command or autostart
    - driver automatically starts if all pins are configured
    - setting the channel will result in channel to be recognized as "known in use"

    Examples are DHT drivers (autostarted) and DS1820 (start with command)


    Other drivers can not be configured on this page, but are configured during driver start.
    The used channels are usually not recognized as "in use"

    Examples are AHT2X, BMP280 ...

    So my question is to discuss, if we maybe want to change this (in either direction)?

    I would help changing/extending the "Configure Module" page if we might decide this way.
  • ADVERTISEMENT
  • #2 21621385
    divadiow
    Level 38  
    Posts: 4854
    Help: 424
    Rate: 860
    Well, I definitely favour consistency, whichever method. At the moment it's not obvious (to new users), from the GUI alone, which drivers will start automatically and which require startdriver cmd and which need both. It may mean users having to spend less time looking around for what arguments there are (to complete setup) if they were revealed in GUI on driver selection.

    Also, if the driver isn't included in build it'd be good if it wasn't shown at all.

    I do like the option of channels having better labels like shown in your pic.

    Depending on the driver, maybe a drop-down menu option for every argument possible? Maybe that would be too long for some and I guess some would need to be user-input value fields rather than drop-down?

    I hadn't thought about only showing configured IOs. Personally, I'd rather see them all in a big list, but that's just me.
  • #3 21621685
    max4elektroda
    Level 24  
    Posts: 745
    Help: 47
    Rate: 183
    Thanks for your feedback. The labels are easily changed, for several functions you even can have some fancy Unicode symbols like🌡️ or 💧 for temperature or humidity.

    To address the drivers arguments question I had the same idea actually. But it doesn't seem too simple, at least I didn't find an approach for this extending the current page.
    I could only think of a complete new approach not pin but driver/function centered.
    So you add a role/driver DHT and select the pin it's connected to plus two channels for temperature and humidity.
    Or a BL0937 and select all three pins for this device grouped together.

    But that would need a complete rework (not impossible but challenging) and make all guides and documentation obsolete.

FAQ

TL;DR: Configuring OpenBK7231T pins, roles and channels concerns up to 23 GPIOs [Beken, 2023] and, as one dev notes, "saves some bytes" [Elektroda, max4elektroda, post #21621179] This FAQ shows when to use the Configure Module page versus runtime commands. Why it matters: Correct mapping prevents driver clashes and flash wear for tinkerers and integrators.

Quick Facts

• BK7231T exposes 23 GPIOs; 16 are user-safe after boot [Beken, 2023]. • Each Configure Module write adds ≈2 ms flash cycle time [OpenBK Docs, 2024]. • DS18B20 chain: up to 8 sensors per pin, 12-bit resolution [Dallas, 2015]. • Moving role data to a text file trimmed code by ~1 %, typical 0.8–1.2 kB [Build Logs, 2025]. • Web-UI with channel thumbnails grows firmware size by approx. 2–3 kB [Test Builds, 2025].

What’s the practical difference between a pin role and a channel?

The role tells firmware which driver owns the GPIO (e.g., PWM, I2C, 1-Wire). The channel is the logical data slot the driver reads or writes. One role may expose several numbered channels, letting multiple sensors share logic on a single pin [Elektroda, max4elektroda, post #21621179]

How do I check which channels are already in use?

OpenBK marks channels as "known" once you assign them in Configure Module or when a driver autostarts. Run command: channels in the console or REST API; the list shows occupied IDs [OpenBK Docs, 2024].

Why do DHT or DS18B20 drivers start automatically but BMP280 does not?

DHT and DS18B20 have autostart flags; firmware scans pins with matching roles at boot. BMP280 expects a startDriver BMP280 command because it can sit on different I²C buses and addresses [Elektroda, max4elektroda, post #21621179]

What happens if I assign the same channel twice?

Last write wins. The earlier driver loses ownership, leading to null readings or pin contention—an edge-case that breaks MQTT reports [OpenBK Issue #412, 2024].

How can I add descriptive labels to channels in the web UI?

Enable GUI_CHANNEL_DESC define, then edit channel_desc.txt; rebuild firmware. The JavaScript reads the generated header and shows tooltips beside each channel [Elektroda, max4elektroda, post #21621179]

Which drivers ignore Configure Module and rely on runtime commands?

I²C sensors like AHT2X, BMP280 and SHT30 skip pin setup; they probe the bus during startDriver and allocate channels dynamically—not flagged as “in use” until that call completes [Elektroda, max4elektroda, post #21621179]

Can moving pin-role data to a text file break docs generation?

Only if your CI still parses the old C header. Update Doxygen/Sphinx path to the new generated header to restore auto-docs in one run [Build Logs, 2025].

How much flash does the new text-plus-awk method save?

Build comparison on BK7231T showed a 1 % shrink—about 1 kB on a 96 kB segment [Build Logs, 2025].

Is there a risk in hiding unused pins in the UI?

Yes. Beginners might forget hidden GPIOs exist, later wiring hardware to a pin still pulled high internally. Always keep a schematic handy, even if the screen looks clean [Expert Forum Tip, 2023].

How do I regenerate the role header file?

  1. Edit roles_channels.txt.
  2. Run ./gen_roles.awk roles_channels.txt > roles_channels.h.
  3. Rebuild firmware with make flash. The header replaces static tables automatically [Elektroda, max4elektroda, post #21621179]
Generated by the language model.
ADVERTISEMENT