logo elektroda
logo elektroda
X
logo elektroda

Clock on ESP12 and MAX7219 display - tutorial - part 1, ArduinoOTA, basics

p.kaczmarek2 3606 59
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • #31 21766583
    max4elektroda
    Level 23  
    I see, that's possible.
    Please choose, which way you prefer:

    1. The driver is not really handled as driver, but it's components are called
    (like the last one I made:
    DRV_Generic_Init() calls CLOCK_Init();
    DRV_AppendInformationToHTTPIndexPage() calls CLOCK_AppendInformationToHTTPIndexPage();
    DRV_OnEverySecond() calls CLOCK_OnEverySecond();
    )

    2. "Extend" the drivers to generally allow for "hidden" drivers (running, but not shown) or, a completely new idea

    3. Distinguish between started and auto-started drivers (e.g. BL0937 is also started without an explicit "startdriver BL0937").
    While thinking of it, it needs another name like "started by system" to avoid mixing with "automatically started" by startup cmd or autoexec.

    Added after 9 [hours] 38 [minutes]:

    Since I got my MAX7219 display this weekend, I tried your project (on a W800).

    Maybe you would like to use some of my changes, too?!?

    I missed "seconds" on display, but the numbers wouldn't fit on the display. So I made some changes and additions to the font used.
    Here is the changed part of the "font" in drv_max72xx_single.c

    - small digits in unused chars 10 to 19 (allows for seconds and a (two digit) year on 4 8x8 displays)
    - made "." smaller (46)
    - made digits smaller (4 columns) but same width for all (no "jump" e.g. from "0" to "1" or "1" to "2")
    Spoiler:

    
    
        0,    // 6 - Unused
       0,    // 7 - Unused
       0,    // 8 - Unused
       0,    // 9 - Unused
       3, 124, 68, 124,   // 10 - 0 mini
       3, 0, 124, 0,      // 11 - 1 mini
       3, 116, 84, 92,      // 12 - 2 mini
       3, 84, 84, 124,      // 13 - 3 mini
       3, 28, 16, 124,      // 14 - 4 mini
       3, 92, 84, 116,      // 15 - 5 mini
       3, 124, 84, 116,   // 16 - 6 mini
       3, 4, 116, 12,      // 17 - 7 mini
       3, 124, 84, 124,   // 18 - 8 mini
       3, 92, 84, 124,      // 19 - 9 mini
       0,    // 20 - Unused
       0,    // 21 - Unused
       0,    // 22 - Unused
       0,    // 23 - Unused
       0,    // 24 - Unused
       0,    // 25 - Unused
       0,    // 26 - Unused
       0,    // 27 - Unused
       0,    // 28 - Unused
       0,    // 29 - Unused
       0,    // 30 - Unused
       0,    // 31 - Unused
       2, 0, 0,                  // 32 - Space
       1, 95,                    // 33 - !
       3, 7, 0, 7,               // 34 - "
       5, 20, 127, 20, 127, 20,  // 35 - #
       5, 36, 42, 127, 42, 18,   // 36 - $
       5, 35, 19, 8, 100, 98,    // 37 - %
       5, 54, 73, 86, 32, 80,    // 38 - &
       2, 4, 3,                  // 39
       3, 28, 34, 65,            // 40 - (
       3, 65, 34, 28,            // 41 - )
       5, 42, 28, 127, 28, 42,   // 42 - *
       5, 8, 8, 62, 8, 8,        // 43 - +
       2, 128, 96,               // 44 - ,
       5, 8, 8, 8, 8, 8,         // 45 - -
    //   2, 96, 96,                // 46 - .
       1, 64,           // 46 - .   (smaller . )
       5, 32, 16, 8, 4, 2,       // 47 - /
       4, 62, 65, 65, 62,        // 48 - 0  (4-column small)
       4, 0, 66, 127, 64,        // 49 - 1  (4-column small)
       4, 114, 73, 73, 70,       // 50 - 2  (4-column small)
       4, 34, 73, 73, 62,        // 51 - 3  (4-column small)
       4, 12, 10, 127, 8,        // 52 - 4  (4-column small)
       4, 39, 73, 73, 49,        // 53 - 5  (4-column small)
       4, 62, 73, 73, 50,        // 54 - 6  (4-column small)
       4, 1, 121, 5, 3,          // 55 - 7  (4-column small)
       4, 54, 73, 73, 54,        // 56 - 8  (4-column small)
       4, 38, 73, 73, 62,     // 57 - 9  (4-column small)
       1, 20,                    // 58 - :
       2, 128, 104,              // 59 - ;
       4, 8, 20, 34, 65,         // 60 - <
       5, 20, 20, 20, 20, 20,    // 61 - =
       



    to use the "small" numbers, the string needs to be "transposed" by -38, so e.g. digit 0 is not using 48 but 10.

    In drv_max72xx_clock.c an additional function:

    void transposeString(char *input, int shift) {
        for (int i = 0; i < strlen(input); i++) {
            input[i] += shift;  // Shift each character by the specified amount
        }
    }
    


    and this output (no temperature here atm), so, just for testing, I display only time and date.
    I used sprintf to print the data, to "seperate" two chars by another empty columns, I used char "127" (this has 0 columns, so only the one after this empty char is written).
    Seconds and year are first printed to a string, which is transposed to use the small numbers I added to the font.


    
    void Clock_Send(int type) {
       char time[64];
       TimeComponents tc;
       float val;
       char *p;
       time_t ntpTime;
    
       ntpTime=(time_t)TIME_GetCurrentTime();
       // NOTE: on windows, you need _USE_32BIT_TIME_T 
       tc=calculateComponents((uint32_t)ntpTime);
    
       time[0] = 0;
       p = time;
       char tempstr[5];   // temp string for seconds or year -> converted to "small" digits
       if (type == CLOCK_TIME) {
    /*
    //      p = my_strcat(p, " ");
          p = add_padded(p, tc.hour);
          p = my_strcat(p, " ");
    //      p = my_strcat(p, ":");
          p = add_padded(p, tc.minute);
          p = my_strcat(p, " ");
    //      p = my_strcat(p, ":");
          p = add_padded(p, tc.second);
          strcat(p, "   ");
    */
          sprintf(tempstr,"%02i",tc.second);
          transposeString(tempstr, -38);      // move second digits from 48 - 57  --> 10 - 19 (small numbers)
          sprintf(time,"%02i:%02i%c%s", tc.hour,tc.minute, 127, tempstr);
       }
       else if (type == CLOCK_DATE) {
    /*
    //      p = my_strcat(p, " ");
          p = add_padded(p, tc.day);
          p = my_strcat(p, ".");
          p = add_padded(p, tc.month);
          p = my_strcat(p, ".");
          //p = add_padded(p, tc.year);
          strcat(p, "   ");
    */
          sprintf(tempstr,"%02i",(tc.year%100));
          transposeString(tempstr, -38);      // move year digits from 48 - 57  --> 10 - 19 (small numbers)      
          sprintf(time,"%02i.%02i.%c%s", tc.day,tc.month, 127, tempstr);
       }
       else if (type == CLOCK_HUMIDITY) {
          if (false==CHANNEL_GetGenericHumidity(&val)) {
             // failed - exit early, do not change string
             return;
          }
          sprintf(time, "H: %i%%   ", (int)val);
       } 
       else if (type == CLOCK_TEMPERATURE) {
          if (false == CHANNEL_GetGenericTemperature(&val)) {
             // failed - exit early, do not change string
             return;
          }
          sprintf(time, "T: %iC    ", (int)val);
       }
    
       CMD_ExecuteCommandArgs("MAX72XX_Print", time, 0);
    }
    ...
    
    // no temperature, so only show date (shorter) and time (longer)
    
    void Run_NoAnimation() {
       cycle+=4;
       if (cycle < 10) {
          Clock_SendDate();
       }
    //   else if(cycle < 20) {
       else {
          Clock_SendTime();
       }
    /*
       else if (cycle < 30) {
          Clock_SendHumidity();
       }
       else {
          Clock_SendTemperature();
       }
    */
       CMD_ExecuteCommandArgs("MAX72XX_refresh", "", 0);
       cycle %= 40;
    }


    Here's how it looks (demonstrating also the setting of the clock):



  • ADVERTISEMENT
  • #32 21767349
    p.kaczmarek2
    Moderator Smart Home
    Thank you for fixes! This is what I meant:
    max4elektroda wrote:

    1. The driver is not really handled as driver, but it's components are called
    (like the last one I made:
    DRV_Generic_Init() calls CLOCK_Init();
    DRV_AppendInformationToHTTPIndexPage() calls CLOCK_AppendInformationToHTTPIndexPage();
    DRV_OnEverySecond() calls CLOCK_OnEverySecond();
    )

    Long story short: I like your changes, but I can't allow many core obk modifications that are not necessary required by features due to our limited testing capability and due to flash size. We have so many platforms that we can't really test them all quickly, so I'd prefer to receive pull request either that are substantially helpful for core OBK, or for components that are not core (drivers).


    max4elektroda wrote:

    Maybe you would like to use some of my changes, too?!?

    Those are probably easy to merge, just what about animated mode? Still, I really like the smaller font for secnds and I have no strict requirements for MAX72XX driver - this driver is not enabled by default so there 0% risk of breaking anything.

    Just let me know which PRs are ready to merge and I'll do it.

    Here's a generic list of ideas/suggestions what can be done next:
    - in general, better MAX72XX, maybe with better scroll transition anims between displays, like there: https://kbprogram.pl/matrycowy-zegar-led-z-termometrem-i-wifi/
    - more self tests for obk, in general
    - do (probably could be done with LLM) a visual addClockEvent configurator that outputs to either autoclock.bat and call it along autoexec.bat on start, or directly to autoexec.bat
    - improve berry bindings and self tests and examples
    - consider making full max72xx clock logic in berry

    PS: you saw that, right? You can prototype on windows https://www.elektroda.com/rtvforum/topic4154322.html
    Helpful post? Buy me a coffee.
  • #33 21767774
    max4elektroda
    Level 23  
    O.k., lets start with the basics - I made a separate PR1877 only containing the fixes:

    Some drivers were still missing arg "int bPreState" in some XX_AppendInformationToHTTPIndexPage() functions and in drv_main.c some functions were missed args for "onHassDiscovery".

    If you are interested how I tried a "complete" fix:

    Identifying "incomplete" AppendInformationToHTTPIndexPage() functions by searching all occurrences with "_AppendInformationToHTTPIndexPage(" and fron the results searching the ones without ","
    (since it should be _AppendInformationToHTTPIndexPage(http_request_t *request, int bPreState) the missing "," indicates a missing ", int bPreState" )

    Spoiler:

    max@Max-PC:~/run/shm/tmp/OpenBK7231T_App$ find src/ -name "*.[ch]" | xargs grep _AppendInformationToHTTPIndexPage\( | grep -v ,
    src/driver/drv_test_uart.c:void Test_UART_AppendInformationToHTTPIndexPage(http_request_t *request) {
    src/driver/drv_test_drivers.h:void Test_AppendInformationToHTTPIndexPage(http_request_t *request);
    src/driver/drv_test_drivers.h:void Test_UART_AppendInformationToHTTPIndexPage(http_request_t *request);
    src/driver/drv_test.c:void Test_AppendInformationToHTTPIndexPage(http_request_t *request)
    src/driver/drv_tasmotaDeviceGroups.c:void DRV_DGR_AppendInformationToHTTPIndexPage(http_request_t* request) {
    src/driver/drv_local.h:void DRV_DGR_AppendInformationToHTTPIndexPage(http_request_t *request);
    src/driver/drv_local.h:void DRV_DDP_AppendInformationToHTTPIndexPage(http_request_t *request);
    src/driver/drv_local.h:void BMP280_AppendInformationToHTTPIndexPage(http_request_t *request);
    src/driver/drv_local.h:void DoorDeepSleep_AppendInformationToHTTPIndexPage(http_request_t *request);
    src/driver/drv_doorSensorWithDeepSleep.c:void DoorDeepSleep_AppendInformationToHTTPIndexPage(http_request_t* request)
    src/driver/drv_ddp.c:void DRV_DDP_AppendInformationToHTTPIndexPage(http_request_t* request)
    src/driver/drv_bmp280.c:void BMP280_AppendInformationToHTTPIndexPage(http_request_t* request)
    



    To find "missing" args for "onHassDiscovery" I searched all "driver lines" and counted the number of "," (it should be 9, but some only had 8)
    Spoiler:
    
    max@Max-PC:~/run/shm/tmp/OpenBK7231T_App$ sed -n  "/{[^}]*}/ {s/[ \t]*//g; s/{//; s/,[^,]*/,/g p}" src/driver/drv_main.c | awk -F "," '{printf("%-20s\t%i\n"), $1 , NF-1}'
    "TuyaMCU"              9
    "tmSensor"             9
    "GirierMCU"            9
    "TCA9554"              9
    "DMX"                  9
    "Freeze"               9
    "TESTSPIFLASH"         9
    "PIR"                  9
    "PixelAnim"            9
    "Drawers"              9
    "HGS02"                9
    "PinMutex"             8
    "GosundSW2"            8
    "TCL"                  9
    "OpenWeatherMap"       9
    "Widget"               9
    "TestCharts"           9
    "Charts"               9
    "NTP"                  9
    "CLOCK"                9
    "DS3231"               9
    "HTTPButtons"          9
    "TESTPOWER"            9
    "TESTLED"              9
    "TESTUART"             9
    "Test"                 9
    "SimpleEEPROM"         9
    "MultiPinI2CScanner"   9
    "I2C"                  9
    "RN8209"               9
    "BL0942"               9
    "PWMG"                 9
    "BL0942SPI"            9
    "HLW8112SPI"           9
    "ChargingLimit"        9
    "BL0937"               9
    "CSE7761"              9
    "CSE7766"              9
    "MAX6675"              9
    "MAX31855"             8
    "PT6523"               9
    "TextScroller"         9
    "SM16703P"             9
    "SM15155E"             9
    "IR"                   9
    "IR"                   9
    "IR2"                  9
    "DDPSend"              9
    "DDP"                  9
    "SSDP"                 9
    "DGR"                  9
    "Wemo"                 9
    "Hue"                  9
    "PWMToggler"           9
    "DoorSensor"           9
    "ADCButton"            9
    "MAX72XX_Clock"        9
    "SM2135"               9
    "BP5758D"              9
    "BP1658CJ"             9
    "SM2235"               9
    "BMP280"               9
    "MAX72XX"              9
    "BMPI2C"               9
    "CHT83XX"              9
    "MCP9808"              9
    "KP18058"              9
    "ADCSmoother"          9
    "SHT3X"                9
    "SGP"                  9
    "ShiftRegister"        9
    "AHT2X"                8
    "DS1820"               8
    "DS1820_FULL"          8
    "HT16K33"              9
    "TM1637"               9
    "GN6932"               9
    "TM1638"               9
    "HD2015"               9
    "Battery"              9
    "BKPartitions"         9
    "Bridge"               9
    "UartTCP"              9
    "TXWCAM"               9
    //""                   9
    
    max@Max-PC:~/run/shm/tmp/OpenBK7231T_App$ 
    max@Max-PC:~/run/shm/tmp/OpenBK7231T_App$ sed -n  "/{[^}]*}/ {s/[ \t]*//g; s/{//; s/,[^,]*/,/g p}" src/driver/drv_main.c | awk -F "," '{printf("%-20s\t%i\n"), $1 , NF-1}' | grep "8$"
    "PinMutex"             8
    "GosundSW2"            8
    "MAX31855"             8
    "AHT2X"                8
    "DS1820"               8
    "DS1820_FULL"          8
    max@Max-PC:~/run/shm/tmp/OpenBK7231T_App$ 
  • #34 21767805
    p.kaczmarek2
    Moderator Smart Home
    Nice, just check if (already partially broken?) getcommands.js still works. It's the script that generates docs
    Helpful post? Buy me a coffee.
  • #35 21767898
    max4elektroda
    Level 23  
    p.kaczmarek2 wrote:
    check if (already partially broken?) getcommands.js still work

    To be honest, I didn't check that (and I should have done, since I "repaired" it some time ago ;-)). Will do an report here about the results.

    Added after 2 [hours] 49 [minutes]:

    You were absolutely right, "getcommands.js" would struggle with the new layout for "commands" in drv_main.c now spanning multiple lines.
    Fixed now, so it works, but running the command shows, there are quite some possible new fixes to make documentation "clean" ;-):

    Actual "mismatches" of "documented" and actual function calls:
     
    $ node scripts/getcommands.js  | grep -A 2  '!!'
    !!!!  "SetChannelEnum" in file cmnds/cmd_channels.c -- fn "SetChannelEnum"  != called function "CMD_SetChannelEnum"  !!!!
        possible fix: sed -i '597,599 { /cmddetail:\"fn\":\"SetChannelEnum\"/ s%SetChannelEnum%CMD_SetChannelEnum% }'  src/cmnds/cmd_channels.c
        test possible fix: sed -n '597,599 { /cmddetail:\"fn\":\"SetChannelEnum\"/ s%SetChannelEnum%CMD_SetChannelEnum% p }'  src/cmnds/cmd_channels.c
    duplicate command "IRSend" docs at file: ./src/driver/drv_ir_new.cpp line: //cmddetail:{"name":"IRSend","args":"[PROT-ADDR-CMD-REP]",
    //cmddetail:{"name":"IRSend","args":"[PROT-ADDR-CMD-REP]",
    duplicate command "IREnable" docs at file: ./src/driver/drv_ir_new.cpp line: //cmddetail:{"name":"IREnable","args":"[Str][1or0]",
    //cmddetail:{"name":"IREnable","args":"[Str][1or0]",
    --
    !!!!  "SM16703P_Init" in file driver/drv_leds_shared.c -- fn "SM16703P_InitForLEDCount"  != called function "Strip_CMD_InitForLEDCount"  !!!!
        possible fix: sed -i '330,332 { /cmddetail:\"fn\":\"SM16703P_InitForLEDCount\"/ s%SM16703P_InitForLEDCount%Strip_CMD_InitForLEDCount% }'  src/driver/drv_leds_shared.c
        test possible fix: sed -n '330,332 { /cmddetail:\"fn\":\"SM16703P_InitForLEDCount\"/ s%SM16703P_InitForLEDCount%Strip_CMD_InitForLEDCount% p }'  src/driver/drv_leds_shared.c
    !!!!  "SM16703P_Start" in file driver/drv_leds_shared.c -- fn "SM16703P_StartTX"  != called function "Strip_CMD_StartTX"  !!!!
        possible fix: sed -i '336,338 { /cmddetail:\"fn\":\"SM16703P_StartTX\"/ s%SM16703P_StartTX%Strip_CMD_StartTX% }'  src/driver/drv_leds_shared.c
        test possible fix: sed -n '336,338 { /cmddetail:\"fn\":\"SM16703P_StartTX\"/ s%SM16703P_StartTX%Strip_CMD_StartTX% p }'  src/driver/drv_leds_shared.c
    !!!!  "SM16703P_SetPixel" in file driver/drv_leds_shared.c -- fn "SM16703P_CMD_setPixel"  != called function "Strip_CMD_setPixel"  !!!!
        possible fix: sed -i '342,344 { /cmddetail:\"fn\":\"SM16703P_CMD_setPixel\"/ s%SM16703P_CMD_setPixel%Strip_CMD_setPixel% }'  src/driver/drv_leds_shared.c
        test possible fix: sed -n '342,344 { /cmddetail:\"fn\":\"SM16703P_CMD_setPixel\"/ s%SM16703P_CMD_setPixel%Strip_CMD_setPixel% p }'  src/driver/drv_leds_shared.c
    !!!!  "SM16703P_SetRaw" in file driver/drv_leds_shared.c -- fn "SM16703P_CMD_setRaw"  != called function "Strip_CMD_setRaw"  !!!!
        possible fix: sed -i '348,350 { /cmddetail:\"fn\":\"SM16703P_CMD_setRaw\"/ s%SM16703P_CMD_setRaw%Strip_CMD_setRaw% }'  src/driver/drv_leds_shared.c
        test possible fix: sed -n '348,350 { /cmddetail:\"fn\":\"SM16703P_CMD_setRaw\"/ s%SM16703P_CMD_setRaw%Strip_CMD_setRaw% p }'  src/driver/drv_leds_shared.c
    duplicate driver docs (in "static driver_t g_drivers[] = {") for drv.name="IR" at file: ./src/driver/drv_main.c  --  actual line://drvdetail:{"name":"IR",
       last "#if" statement: "#if ENABLE_DRIVER_IR"
       first defined with "#if" statement: "#if ENABLE_DRIVER_IRREMOTEESP"
    --
    !!!!  "Gen" in file driver/drv_tclAC.c -- fn "Gen"  != called function "CMD_Gen"  !!!!
        possible fix: sed -i '788,790 { /cmddetail:\"fn\":\"Gen\"/ s%Gen%CMD_Gen% }'  src/driver/drv_tclAC.c
        test possible fix: sed -n '788,790 { /cmddetail:\"fn\":\"Gen\"/ s%Gen%CMD_Gen% p }'  src/driver/drv_tclAC.c
    



    and some missing documentation

    $ node scripts/getcommands.js  | grep  '^updated'
    updated ./src/driver/drv_girierMCU.c
    updated ./src/driver/drv_hlw8112.c
    duplicate command "IRSend" docs at file: ./src/driver/drv_ir_new.cpp line: //cmddetail:{"name":"IRSend","args":"[PROT-ADDR-CMD-REP]",
    //cmddetail:{"name":"IRSend","args":"[PROT-ADDR-CMD-REP]",
    duplicate command "IREnable" docs at file: ./src/driver/drv_ir_new.cpp line: //cmddetail:{"name":"IREnable","args":"[Str][1or0]",
    //cmddetail:{"name":"IREnable","args":"[Str][1or0]",
    duplicate driver docs at file: ./src/driver/drv_main.c line: static driver_t g_drivers[] = {
    static driver_t g_drivers[] = {
    updated ./src/driver/drv_main.c
    updated ./src/driver/drv_max72xx_clock.c
    updated ./src/driver/drv_max72xx_single.c
    updated ./src/driver/drv_simpleEEPROM.c
    updated ./src/mqtt/new_mqtt.c
    $ 
    $ for F in $(node scripts/getcommands.js  2>/dev/null | grep  '^updated' | sed "s/updated //" ); do diff -u $F $F.getcommands ; done
    --- ./src/driver/drv_girierMCU.c   2025-12-01 10:07:17.392170672 +0100
    +++ ./src/driver/drv_girierMCU.c.getcommands   2025-12-01 14:14:35.192343305 +0100
    @@ -554,7 +554,15 @@
        UART_InitUART(g_baudRate, 0, false);
        UART_InitReceiveRingBuffer(1024);
        GirierMCU_SendInit();
    +   //cmddetail:{"name":"linkGirierMCUOutputToChannel","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"GirierMCU_LinkGirierMCUOutputToChannel","file":"driver/drv_girierMCU.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("linkGirierMCUOutputToChannel", GirierMCU_LinkGirierMCUOutputToChannel, NULL);
    +   //cmddetail:{"name":"GirierMCU_setBaudRate","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"GirierMCU_SetBaudRate","file":"driver/drv_girierMCU.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("GirierMCU_setBaudRate", GirierMCU_SetBaudRate, NULL);
     
     }
    --- ./src/driver/drv_hlw8112.c   2025-12-01 10:07:17.392170672 +0100
    +++ ./src/driver/drv_hlw8112.c.getcommands   2025-12-01 14:14:35.194343270 +0100
    @@ -481,15 +481,51 @@
     #endif
     
     void HLW8112_addCommads(void){
    +   //cmddetail:{"name":"HLW8112_SetClock","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"HLW8112_SetClock","file":"driver/drv_hlw8112.c","requires":"",
    +   //cmddetail:"examples":""}
         CMD_RegisterCommand("HLW8112_SetClock", HLW8112_SetClock, NULL);
    +   //cmddetail:{"name":"HLW8112_SetResistorGain","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"HLW8112_SetResistorGain","file":"driver/drv_hlw8112.c","requires":"",
    +   //cmddetail:"examples":""}
         CMD_RegisterCommand("HLW8112_SetResistorGain", HLW8112_SetResistorGain, NULL);
    +   //cmddetail:{"name":"HLW8112_SetEnergyStat","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"HLW8112_SetEnergyStat","file":"driver/drv_hlw8112.c","requires":"",
    +   //cmddetail:"examples":""}
         CMD_RegisterCommand("HLW8112_SetEnergyStat", HLW8112_SetEnergyStat, NULL);
    +   //cmddetail:{"name":"clear_energy","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"HLW8112_ClearEnergy","file":"driver/drv_hlw8112.c","requires":"",
    +   //cmddetail:"examples":""}
         CMD_RegisterCommand("clear_energy", HLW8112_ClearEnergy, NULL);
     #if HLW8112_SPI_RAWACCESS
    +   //cmddetail:{"name":"HLW8112_write_reg","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"HLW8112_write_reg","file":"driver/drv_hlw8112.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("HLW8112_write_reg", HLW8112_write_reg, NULL);
    +   //cmddetail:{"name":"HLW8112_read_reg","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"HLW8112_read_reg","file":"driver/drv_hlw8112.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("HLW8112_read_reg", HLW8112_read_reg, NULL);
    +   //cmddetail:{"name":"HLW8112_print_coeff","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"HLW8112_print_coeff","file":"driver/drv_hlw8112.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("HLW8112_print_coeff", HLW8112_print_coeff, NULL);
    +   //cmddetail:{"name":"HLW8112_c","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"HLW8112_c","file":"driver/drv_hlw8112.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("HLW8112_c", HLW8112_c, NULL);
    +   //cmddetail:{"name":"HLW8112_a","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"HLW8112_a","file":"driver/drv_hlw8112.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("HLW8112_a", HLW8112_a, NULL);
     #endif
     }
    --- ./src/driver/drv_main.c   2025-12-01 10:08:21.566991406 +0100
    +++ ./src/driver/drv_main.c.getcommands   2025-12-01 14:14:35.201343147 +0100
    @@ -68,6 +68,10 @@
        },
     #endif
     #ifdef ENABLE_DRIVER_GIRIERMCU
    +   //drvdetail:{"name":"GirierMCU",
    +   //drvdetail:"title":"GirierMCU",
    +   //drvdetail:"descr":"TODO",
    +   //drvdetail:"requires":""}
        { "GirierMCU",                           // Driver Name
        GirierMCU_Init,                          // Init
        GirierMCU_RunEverySecond,                // onEverySecond
    @@ -79,7 +83,6 @@
        false,                                   // loaded
        },
     #endif
    -
     #if ENABLE_DRIVER_TCA9554
        //drvdetail:{"name":"TCA9554",
        //drvdetail:"title":"TODO",
    @@ -752,7 +755,6 @@
        false,                                   // loaded
        },
     #endif
    -
     #if ENABLE_DRIVER_DDPSEND
        //drvdetail:{"name":"DDPSend",
        //drvdetail:"title":"TODO",
    --- ./src/driver/drv_max72xx_clock.c   2025-12-01 10:07:17.393170656 +0100
    +++ ./src/driver/drv_max72xx_clock.c.getcommands   2025-12-01 14:14:35.202343129 +0100
    @@ -243,6 +243,10 @@
     }
     void DRV_MAX72XX_Clock_Init() {
     
    +   //cmddetail:{"name":"MAX72XXClock_Animate","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"DRV_MAX72XX_Clock_Animate","file":"driver/drv_max72xx_clock.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("MAX72XXClock_Animate", DRV_MAX72XX_Clock_Animate, NULL);
     }
     
    --- ./src/driver/drv_max72xx_single.c   2025-12-01 10:07:17.393170656 +0100
    +++ ./src/driver/drv_max72xx_single.c.getcommands   2025-12-01 14:14:35.203343112 +0100
    @@ -494,13 +494,25 @@
        //cmddetail:"examples":""}
        CMD_RegisterCommand("MAX72XX_Print", DRV_MAX72XX_Print, NULL);
     
    +   //cmddetail:{"name":"MAX72XX_refresh","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"DRV_MAX72XX_Show","file":"driver/drv_max72xx_single.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("MAX72XX_refresh", DRV_MAX72XX_Show, NULL);
        
        //cmddetail:{"name":"DRV_MAX72XX_Clear","args":"DRV_MAX72XX_Clear",
        //cmddetail:"descr":"",
        //cmddetail:"fn":"DRV_DRV_MAX72XX_Clear","file":"driver/drv_max72xx_single.c","requires":"",
        //cmddetail:"examples":""}
    +   //cmddetail:{"name":"MAX72XX_Clear","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"DRV_MAX72XX_Clear","file":"driver/drv_max72xx_single.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("MAX72XX_Clear", DRV_MAX72XX_Clear, NULL);
    +   //cmddetail:{"name":"MAX72XX_SetPixel","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"DRV_MAX72XX_SetPixel","file":"driver/drv_max72xx_single.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("MAX72XX_SetPixel", DRV_MAX72XX_SetPixel, NULL);
     }
     
    --- ./src/driver/drv_simpleEEPROM.c   2025-12-01 10:07:17.395170622 +0100
    +++ ./src/driver/drv_simpleEEPROM.c.getcommands   2025-12-01 14:14:35.208343024 +0100
    @@ -163,8 +163,20 @@
        g_eepI2C.pin_clk = Tokenizer_GetArgIntegerDefault(1, g_eepI2C.pin_clk); 
        g_eepI2C.pin_data = Tokenizer_GetArgIntegerDefault(2, g_eepI2C.pin_data);
        Soft_I2C_PreInit(&g_eepI2C);
    +   //cmddetail:{"name":"EEPROM_Read","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"EEPROM_ReadCmd","file":"driver/drv_simpleEEPROM.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("EEPROM_Read", EEPROM_ReadCmd, NULL);
    +   //cmddetail:{"name":"EEPROM_WriteHex","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"EEPROM_WriteHexCmd","file":"driver/drv_simpleEEPROM.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("EEPROM_WriteHex", EEPROM_WriteHexCmd, NULL);
    +   //cmddetail:{"name":"EEPROM_Dump","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"EEPROM_DumpCmd","file":"driver/drv_simpleEEPROM.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("EEPROM_Dump", EEPROM_DumpCmd, NULL);
     }
     
    --- ./src/mqtt/new_mqtt.c   2025-12-01 10:07:17.423170156 +0100
    +++ ./src/mqtt/new_mqtt.c.getcommands   2025-12-01 14:14:35.316341125 +0100
    @@ -1995,6 +1995,10 @@
     #endif
     
     
    +   //cmddetail:{"name":"publishDriver","args":"TODO",
    +   //cmddetail:"descr":"",
    +   //cmddetail:"fn":"MQTT_PublishCommandDriver","file":"mqtt/new_mqtt.c","requires":"",
    +   //cmddetail:"examples":""}
        CMD_RegisterCommand("publishDriver", MQTT_PublishCommandDriver, NULL);
     }
     static float getInternalTemperature() {
    


    Added after 1 [hours] 30 [minutes]:

    Last two commits of this PR fixed all "compaints" from getcommands.js (leaving only the two "IR" errors).

    I don't want to change these, maybe you can take a look? One possible fix would be:

    instead of
    #if ENABLE_DRIVER_IRREMOTEESP
    ...
    #if ENABLE_DRIVER_IR

    use
    #if ENABLE_DRIVER_IRREMOTEESP ||  ENABLE_DRIVER_IR


    Not sure how to resolve both IR and IR2 defining "IRSend" and "IREnable" ("src/driver/drv_ir_new.cpp" and "src/driver/drv_ir.cpp").


    $ node scripts/getcommands.js 
    starting
    cnst type name: MQTTOn
    cnst type name: $MQTTOn
    cnst type name: $CH***
    cnst type name: $CH**
    cnst type name: $CH*
    cnst type name: $FLAG**
    cnst type name: $FLAG*
    cnst type name: $led_dimmer
    cnst type name: $led_enableAll
    cnst type name: $led_hue
    cnst type name: $led_red
    cnst type name: $led_green
    cnst type name: $led_blue
    cnst type name: $led_saturation
    cnst type name: $led_temperature
    cnst type name: $activeRepeatingEvents
    cnst type name: $Flash*
    cnst type name: $voltage
    cnst type name: $current
    cnst type name: $power
    cnst type name: $frequency
    cnst type name: $energy
    cnst type name: $day
    cnst type name: $hour
    cnst type name: $minute
    cnst type name: $second
    cnst type name: $mday
    cnst type name: $month
    cnst type name: $year
    cnst type name: $yesterday
    cnst type name: $today
    cnst type name: $isDST
    cnst type name: $sunrise
    cnst type name: $sunset
    cnst type name: $NTPOn
    cnst type name: $batteryVoltage
    cnst type name: $batteryLevel
    cnst type name: $uptime
    cnst type name: $failedBoots
    cnst type name: $rand01
    cnst type name: $rand
    cnst type name: $rebootReason
    cnst type name: $intTemp
    duplicate command "IRSend" docs at file: ./src/driver/drv_ir_new.cpp line: //cmddetail:{"name":"IRSend","args":"[PROT-ADDR-CMD-REP]",
    //cmddetail:{"name":"IRSend","args":"[PROT-ADDR-CMD-REP]",
    duplicate command "IREnable" docs at file: ./src/driver/drv_ir_new.cpp line: //cmddetail:{"name":"IREnable","args":"[Str][1or0]",
    //cmddetail:{"name":"IREnable","args":"[Str][1or0]",
    drv type name: TuyaMCU
    drv type name: tmSensor
    drv type name: GirierMCU
    drv type name: TCA9554
    drv type name: DMX
    drv type name: Freeze
    drv type name: TESTSPIFLASH
    drv type name: PIR
    drv type name: PixelAnim
    drv type name: Drawers
    drv type name: HGS02
    drv type name: PinMutex
    drv type name: GosundSW2
    drv type name: TCL
    drv type name: OpenWeatherMap
    drv type name: Widget
    drv type name: TestCharts
    drv type name: Charts
    drv type name: NTP
    drv type name: HTTPButtons
    drv type name: TESTPOWER
    drv type name: TESTLED
    drv type name: TESTUART
    drv type name: Test
    drv type name: SimpleEEPROM
    drv type name: MultiPinI2CScanner
    drv type name: I2C
    drv type name: RN8209
    drv type name: BL0942
    drv type name: PWMG
    drv type name: BL0942SPI
    drv type name: HLW8112SPI
    drv type name: ChargingLimit
    drv type name: BL0937
    drv type name: CSE7761
    drv type name: CSE7766
    drv type name: MAX6675
    drv type name: MAX31855
    drv type name: PT6523
    drv type name: TextScroller
    drv type name: SM16703P
    drv type name: SM15155E
    drv type name: IR
    duplicate driver docs (in "static driver_t g_drivers[] = {") for drv.name="IR" at file: ./src/driver/drv_main.c  --  actual line://drvdetail:{"name":"IR",
       last "#if" statement: "#if ENABLE_DRIVER_IR"
       first defined with "#if" statement: "#if ENABLE_DRIVER_IRREMOTEESP"
    drv type name: IR
    drv type name: IR2
    drv type name: DDPSend
    drv type name: DDP
    drv type name: SSDP
    drv type name: DGR
    drv type name: Wemo
    drv type name: Hue
    drv type name: PWMToggler
    drv type name: DoorSensor
    drv type name: ADCButton
    drv type name: MAX72XX_Clock
    drv type name: SM2135
    drv type name: BP5758D
    drv type name: BP1658CJ
    drv type name: SM2235
    drv type name: BMP280
    drv type name: MAX72XX
    drv type name: BMPI2C
    drv type name: CHT83XX
    drv type name: MCP9808
    drv type name: KP18058
    drv type name: ADCSmoother
    drv type name: SHT3X
    drv type name: SGP
    drv type name: ShiftRegister
    drv type name: AHT2X
    drv type name: DS1820
    drv type name: DS1820_FULL
    drv type name: HT16K33
    drv type name: TM1637
    drv type name: GN6932
    drv type name: TM1638
    drv type name: HD2015
    drv type name: Battery
    drv type name: BKPartitions
    drv type name: Bridge
    drv type name: UartTCP
    drv type name: TXWCAM
    ionel type name: None
    ionel type name: Relay
    ionel type name: Relay_n
    ionel type name: Button
    ionel type name: Button_n
    ionel type name: LED
    ionel type name: LED_n
    ionel type name: PWM
    ionel type name: LED_WIFI
    ionel type name: LED_WIFI_n
    ionel type name: Button_ToggleAll
    ionel type name: Button_ToggleAll_n
    ionel type name: DigitalInput
    ionel type name: DigitalInput_n
    ionel type name: ToggleChannelOnToggle
    ionel type name: DigitalInput_NoPup
    ionel type name: DigitalInput_NoPup_n
    ionel type name: BL0937_SEL
    ionel type name: BL0937_CF
    ionel type name: BL0937_CF1
    ionel type name: ADC
    ionel type name: SM2135_DAT
    ionel type name: SM2135_CLK
    ionel type name: BP5758D_DAT
    ionel type name: BP5758D_CLK
    ionel type name: BP1658CJ_DAT
    ionel type name: BP1658CJ_CLK
    ionel type name: PWM_n
    ionel type name: IRRecv
    ionel type name: IRSend
    ionel type name: Button_NextColor
    ionel type name: Button_NextColor_n
    ionel type name: Button_NextDimmer
    ionel type name: Button_NextDimmer_n
    ionel type name: AlwaysHigh
    ionel type name: AlwaysLow
    ionel type name: UCS1912_DIN
    ionel type name: SM16703P_DIN
    ionel type name: Button_NextTemperature
    ionel type name: Button_NextTemperature_n
    ionel type name: Button_ScriptOnly
    ionel type name: Button_ScriptOnly_n
    ionel type name: DHT11
    ionel type name: DHT12
    ionel type name: DHT21
    ionel type name: DHT22
    ionel type name: CHT83XX_DAT
    ionel type name: CHT83XX_CLK
    ionel type name: SHT3X_DAT
    ionel type name: SHT3X_CLK
    ionel type name: SOFT_SDA
    ionel type name: SOFT_SCL
    ionel type name: SM2235_DAT
    ionel type name: SM2235_CLK
    ionel type name: BridgeForward
    ionel type name: BridgeReverse
    ionel type name: SmartButtonForLEDs
    ionel type name: SmartButtonForLEDs_n
    ionel type name: DoorSensorWithDeepSleep
    ionel type name: DoorSensorWithDeepSleep_NoPup
    ionel type name: BAT_ADC
    ionel type name: BAT_Relay
    ionel type name: TM1637_DIO
    ionel type name: TM1637_CLK
    ionel type name: BL0937_SEL_n
    ionel type name: DoorSensorWithDeepSleep_pd
    ionel type name: SGP_CLK
    ionel type name: SGP_DAT
    ionel type name: ADC_Button
    ionel type name: GN6932_CLK
    ionel type name: GN6932_DAT
    ionel type name: GN6932_STB
    ionel type name: TM1638_CLK
    ionel type name: TM1638_DAT
    ionel type name: TM1638_STB
    ionel type name: BAT_Relay_n
    ionel type name: KP18058_CLK
    ionel type name: KP18058_DAT
    ionel type name: DS1820_IO
    ionel type name: PWM_ScriptOnly
    ionel type name: PWM_ScriptOnly_n
    ionel type name: Counter_f
    ionel type name: Counter_r
    ionel type name: IRRecv_nPup
    ionel type name: StripState
    ionel type name: StripState_n
    ionel type name: HLW8112_SCSN
    ionel type name: Total_Options
    Channel type name: Default
    Channel type name: Error
    Channel type name: Temperature
    Channel type name: Humidity
    Channel type name: Humidity_div10
    Channel type name: Temperature_div10
    Channel type name: Toggle
    Channel type name: Dimmer
    Channel type name: LowMidHigh
    Channel type name: TextField
    Channel type name: ReadOnly
    Channel type name: OffLowMidHigh
    Channel type name: OffLowestLowMidHighHighest
    Channel type name: LowestLowMidHighHighest
    Channel type name: Dimmer256
    Channel type name: Dimmer1000
    Channel type name: Frequency_div100
    Channel type name: Voltage_div10
    Channel type name: Power
    Channel type name: Current_div100
    Channel type name: ActivePower
    Channel type name: PowerFactor_div1000
    Channel type name: ReactivePower
    Channel type name: EnergyTotal_kWh_div1000
    Channel type name: EnergyExport_kWh_div1000
    Channel type name: EnergyToday_kWh_div1000
    Channel type name: Current_div1000
    Channel type name: EnergyTotal_kWh_div100
    Channel type name: OpenClosed
    Channel type name: OpenClosed_Inv
    Channel type name: BatteryLevelPercent
    Channel type name: OffDimBright
    Channel type name: LowMidHighHighest
    Channel type name: OffLowMidHighHighest
    Channel type name: Custom
    Channel type name: Power_div10
    Channel type name: ReadOnlyLowMidHigh
    Channel type name: SmokePercent
    Channel type name: Illuminance
    Channel type name: Toggle_Inv
    Channel type name: OffOnRemember
    Channel type name: Voltage_div100
    Channel type name: Temperature_div2
    Channel type name: TimerSeconds
    Channel type name: Frequency_div10
    Channel type name: PowerFactor_div100
    Channel type name: Pressure_div100
    Channel type name: Temperature_div100
    Channel type name: LeakageCurrent_div1000
    Channel type name: Power_div100
    Channel type name: Motion
    Channel type name: ReadOnly_div10
    Channel type name: ReadOnly_div100
    Channel type name: ReadOnly_div1000
    Channel type name: Ph
    Channel type name: Orp
    Channel type name: Tds
    Channel type name: Motion_n
    Channel type name: Frequency_div1000
    Channel type name: OpenStopClose
    Channel type name: Percent
    Channel type name: StopUpDown
    Channel type name: EnergyImport_kWh_div1000
    Channel type name: Enum
    Channel type name: ReadOnlyEnum
    Channel type name: Current_div10
    Channel type name: Max
    Going to read docs/json/faq.json
    Going to read docs/json/generic.json
    Going to read docs/json/commandExamples.json
    Going to read docs/json/autoexecExamples.json
    Going to read docs/json/scriptExamples.json
    Going to read docs/json/mqttTopics.json
    Going to read docs/json/subpages.json
    wrote docs/ioRoles.md
    There are 88 ioRoles
    wrote docs/json/ioRoles.json
    wrote docs/flags.md
    There are 52 flags
    wrote docs/json/flags.json
    wrote docs/drivers.md
    There are 81 drivers
    wrote docs/json/drivers.json
    wrote docs/constants.md
    There are 43 constants
    wrote docs/json/constants.json
    wrote docs/channelTypes.md
    There are 67 channelTypes
    wrote docs/json/channelTypes.json
    wrote docs/faq.md
    There are 31 faq
    wrote docs/commands.md
    There are 393 commands
    wrote docs/json/commands.json
    wrote docs/commandExamples.md
    There are 11 commandExamples
    wrote docs/autoexecExamples.md
    There are 38 autoexecExamples
    wrote docs/mqttTopics.md
    There are 25 mqttTopics
    wrote docs/scriptExamples.md
    There are 6 scriptExamples
    wrote docs/commands-extended.md
    There are 393 commands-extended
    wrote docs/initialSetup.md
    wrote docs/safeMode.md
    wrote docs/tcpServer.md
    wrote docs/homeAssistant.md
    wrote docs/README.md
    
  • #36 21768233
    p.kaczmarek2
    Moderator Smart Home
    Saving related #if definition name is a good idea. Maybe for now add a hardcoded fix or allow multiple if values for single driver name. So, keep an array.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #37 21768357
    max4elektroda
    Level 23  
    I think I didn't get it, the message only indicates that the documentation is not "unique", but what about the code itself?

    Both drivers are registering the same commands, if I'm not mistaken.
    I didn't/don't use IR, so I'm not sure what happens, if both are present, or is there something preventing enabling both?
  • #38 21768745
    p.kaczmarek2
    Moderator Smart Home
    Ah, that's what you asked for. Well, then explanation is simple - it's not possible to use both at the same time and they are never present in single binary together.
    Helpful post? Buy me a coffee.
  • #39 21770009
    max4elektroda
    Level 23  
    I did "tune" getcommands.js a bit more. Now the only "complaints" left are:

    $ node scripts/getcommands.js >/dev/null
    duplicate command "IRSend" docs at file: ./src/driver/drv_ir_new.cpp line: //cmddetail:{"name":"IRSend","args":"[PROT-ADDR-CMD-REP]",
       first seen in "driver/drv_ir.cpp"
       First found:
          "{"name":"IRSend"
             "args":"[PROT-ADDR-CMD-REP-BITS]"
             "descr":"Sends IR commands in the form PROT-ADDR-CMD-REP-BITS, e.g. NEC-1-1A-0-0, note that -BITS is optional, it can be 0 for default one, so you can just do NEC-1-1A-0"
             "fn":"IR_Send_Cmd"
             "file":"driver/drv_ir_new.cpp"
             "requires":""
             "examples":""}"
       this occurence:
          "{"name":"IRSend"
             "args":"[PROT-ADDR-CMD-REP]"
             "descr":"Sends IR commands in the form PROT-ADDR-CMD-REP, e.g. NEC-1-1A-0"
             "fn":"IR_Send_Cmd"
             "file":"driver/drv_ir_new.cpp"
             "requires":""
             "examples":""}
    duplicate command "IREnable" docs at file: ./src/driver/drv_ir_new.cpp line: //cmddetail:{"name":"IREnable","args":"[Str][1or0]",
       first seen in "driver/drv_ir.cpp"
       should be safe to ignore, they are equal beside the file name!
    duplicate driver docs (in "static driver_t g_drivers[] = {") for drv.name="IR" at file: ./src/driver/drv_main.c  --  actual line://drvdetail:{"name":"IR",
       last "#if" statement: "#if ENABLE_DRIVER_IR"
       first defined with "#if" statement: "#if ENABLE_DRIVER_IRREMOTEESP"
       should be safe to ignore, because documentation is equal!
    


    So in the end, there's only one point open:
    The two commands "IRSend" differ in their description - then its impossible to "write" a (simple/automated) documentation if the arguments for the same command are not the same.
  • #40 21770097
    p.kaczmarek2
    Moderator Smart Home
    Can we readd -BITS to other driver?

    Or maybe just ignore it for now, apart from that, ready to merge{/b]?
    Helpful post? Buy me a coffee.
  • #41 21770146
    max4elektroda
    Level 23  
    p.kaczmarek2 wrote:
    Or maybe just ignore it for now

    Full ack!
    p.kaczmarek2 wrote:
    apart from that, ready to merge?

    Yes, PR is ready to merge
  • ADVERTISEMENT
  • #42 21770257
    p.kaczmarek2
    Moderator Smart Home
    Thank you, merged. What's the suggested next step?
    Helpful post? Buy me a coffee.
  • #43 21770282
    max4elektroda
    Level 23  
    I'll fix TIME (CLOCK) driver so its not displayed.
    Then I think DS3231 driver (including the CLOCK) should be ready.

    My next steps would be working some more on the MAX7219 clock (the fonts): atm I'm changing the "basic" font in drv_max72xx_single.c, not only for the "small" number, but also changing the numbers to be smaller and "fixed size".

    I'm thinking on how to add some "alternate" font to use, e.g. when showing time/date from clock.

    And if the "new" clock/time-handling is present, I can update my "collection" of additional time sources I made over the time:
    - NEO6 (using GPS for time and even lat/long),
    - DCF77 radio controlled clock (the station is in Frankfurt, so I don't know how far away this works...)
    - a simlpe/hacky "HTTP" time-source - if the device is in a network and the router has a synchronized time, "TIME" field in HTTP header can be used as a source

    (you see, I thought about quite some possibilities to set the time without needing device to have internet access.

    Added after 1 [hours] 44 [minutes]:

    PR #1792 updated:

    Using "Time" for functions (instead of CLOCK), it's no longer visible as driver, DS3231 driver disabled for all platforms.

    So should be ready to merge now
  • #44 21771184
    p.kaczmarek2
    Moderator Smart Home
    Ok, I've decided to take this little risk and merged it, hopefully it will be stable. Please keep an eye on other platforms, etc.

    So, if I rebuild driver docs now, will it says which #define is required?
    Helpful post? Buy me a coffee.
  • #45 21771225
    max4elektroda
    Level 23  
    Thanks.
    p.kaczmarek2 wrote:
    So, if I rebuild driver docs now, will it says which #define is required?

    The "#define" actually was only used to find a possible issue with duplicates (displayed in case of an error).
    But I agree, this might be a good idea also to include this into the documentation.

    Do you have a suggestion, how to include?
    Then I can try a possible change to the code.

    Added after 2 [hours] 7 [minutes]:

    What about

    Drivers table with descriptions and activation info via #define macros.
    
    diff --git a/scripts/getcommands.js b/scripts/getcommands.js
    index c989aa178c..28cdffaa9b 100644
    --- a/scripts/getcommands.js
    +++ b/scripts/getcommands.js
    @@ -412,6 +412,7 @@ function getFolder(name, cb) {
     										 else console.error('\tFirst occurence:\n\t\t"' + JSON.stringify(drvindex[drv.name])  + '"\n\tactual:\n\t\t"' + JSON.stringify(drv) + '"' );
     										//console.error(line);
     									} else {
    +										drv.define = 'Enabled by defining "' + lasthash.replace(/#if[^ ]* /,"") + '"';
     										drvs.push(drv);
     										drvindex[drv.name] = drv;
     										drvdefines[drv.name] = lasthash;
    @@ -1044,7 +1045,7 @@ for (let i = 0; i < drvs.length; i++) {
     
     	let descMore = "<br/>" + genReadMore(drv.name);
     	let descBasic = formatDesc(drv.descr);
    -	let textshort = `| ${drv.name} |  ${descBasic}${descMore} |`;
    +	let textshort = `| ${drv.name} |  ${descBasic}\n${drv.define}${descMore} |`;
     
     	// allow multi-row entries in table entries.
     	textshort = textshort.replace(/\n/g, '<br/>');
    
  • #46 21771396
    p.kaczmarek2
    Moderator Smart Home
    Yes, just add bold for define, and note to add it for given platform section. And add "read more": https://www.elektroda.com/rtvforum/topic4033833.html
    Helpful post? Buy me a coffee.
  • #47 21772169
    max4elektroda
    Level 23  
    Two ideas, please choose:

    all in second column:
    Driver table listing names and usage descriptions for various MCU modules

    add a third column:
    Table of drivers with descriptions and defines for enabling them
  • #48 21772187
    p.kaczmarek2
    Moderator Smart Home
    Which is more mobile friendly? I don't have strong feelings one way or the other, but I think we may have some mobile users?
    Helpful post? Buy me a coffee.
  • #49 21772201
    max4elektroda
    Level 23  
    Two columns are easier on a small display, as an example this is what it will look like on an older iphone 12/13 (landscape).

    Driver table from OpenBK7231T documentation showing TuyaMCU protocol entry

    Documentation table for TuyaMCU driver with description and example links

    On the other hand, we now have some three column docs, too, e.g. for commands, which won't even fit:

    Screenshot of GitHub documentation table showing the AB_Map command entry
  • #50 21772214
    p.kaczmarek2
    Moderator Smart Home
    Let's do two columns and merge, we can improve futher docs later.
    Helpful post? Buy me a coffee.
  • #51 21772253
    max4elektroda
    Level 23  
    Prepared. Would you like me only to change "getcommands.js" or also update documentation in the PR?
  • #52 21772357
    p.kaczmarek2
    Moderator Smart Home
    You can update docs as well, no problem, thanks. Docs aren't as crucial as core firmware.
    Helpful post? Buy me a coffee.
  • #54 21772517
    p.kaczmarek2
    Moderator Smart Home
    Great. What next? Probably "defining" could also point to obk_config.h
    Helpful post? Buy me a coffee.
  • #55 21773515
    max4elektroda
    Level 23  
    If you like, I can add a hint. Any suggestions?

    To this topic again: how's "MAX72XXClock_Animate 1" expected to work? I think the string with time and date should scroll over the display? For me it only shows the time...
    Did it work before?
    I got the same in simulation with a previous version...
    I suspect writing to a buffer not larger than the display, so there's nothing to scroll?!?
  • ADVERTISEMENT
  • #56 21773576
    p.kaczmarek2
    Moderator Smart Home
    I know it's broken. It was working by doing infinite scroll with text in loop that was updated when scroll offset was 0 (it wraps around so it's easy to detect it), but I wanted a better effect, namely, static time that after few seconds scrolls seamlessly to date, and again, a delay, and a seamless scroll to temps, etc. I didn't figure how to do it yet. Currently I would guess the logic in animated version is broken.

    Added after 2 [minutes]:

    For link, I'd guess just https://github.com/openshwprojects/OpenBK7231T_App/blob/main/src/obk_config.h

    Added after 4 [hours] 49 [minutes]:

    @max4elektroda next task:
    https://github.com/openshwprojects/OpenBK7231T_App/issues/1885#issuecomment-3621870769
    Helpful post? Buy me a coffee.
  • #57 21774727
    max4elektroda
    Level 23  
    p.kaczmarek2 wrote:
    I wanted a better effect, namely, static time that after few seconds scrolls seamlessly to date, and again, a delay, and a seamless scroll to temps, etc.


    Maybe you would like it the way I tried here?

    I made some changes to use an "own" font inside clock and building a "shadow" for the actual display bitmap.
    So I only need to copy my shadow to displays "led_status".

    This way, I can also do animation inside clock code.

    General idea:
    two vars, used for "timing" and deciding, if we are in "static" or "animated" time slot:
    static int g_animationcycles = 0 ;   // how many columns to scroll; if > 0 we are "ainmating" the display --> don't show fixed content
    static int g_keepdisplay = 0 ;      // how many seconds left to keep actual "static" display; if > 0 we must not "ainmate" the display --> only show/update "fixed" content (time, date, temp, hum)
    


    There is some hard coded part for the arrays I use, but it's a proof of concept, you might want to use for further tries

    Works o.k. for me on real HW and on simulator with

    backlog  startDriver ntp ;  SetPinRole 11 DHT11; SetPinChannel 11 2 3; setChannelType 2 Temperature_div10; setChannelType 3 Humidity; startDriver MAX72XX; MAX72XX_Setup 4 3 2; startDriver MAX72XX_Clock; MAX72XXCLOCK_Animate 1




  • #58 21774846
    p.kaczmarek2
    Moderator Smart Home
    Very nice, I think it could be acceptable for DIY and I will merge it, but could you add a space there?
    Digital LED display grid showing the time 12:36 with a red arrow pointing at digit 3

    Also, I assume it loops seamlessly? And humidity/temperature etc is shown only if there is a sensor.
    Helpful post? Buy me a coffee.
  • #59 21775058
    max4elektroda
    Level 23  
    p.kaczmarek2 wrote:
    ...but could you add a space there?




    Done (https://github.com/openshwprojects/OpenBK7231T_App/pull/1889), the space or time in "static" can be changed here, if you like more/less space:

    Code snippet with added SECSinSTATIC and AnimStartIndex definitions
    p.kaczmarek2 wrote:
    Also, I assume it loops seamlessly? And humidity/temperature etc is shown only if there is a sensor.

    Looks good for me, but you can easily try with simulator from build if it's o.k for you (screen recording is a bit lagging, because it's done in a VM).
    And if temp/hum is not present, it will be skipped,


    Caution: This PR also has the changes discussed here (using a pinindex equal to IO number for ESP8266)

    p.kaczmarek2 wrote:

    That's quite some work to change the code so e.g. examples could be extracted.
    At least a minimum version can be found here here in PR#1888:

    Changed the text driver so the "define part" will point to obk_config.h
    Table listing TuyaMCU and tmSensor drivers with descriptions and documentation links

    And a very basic doc for events:

    Table listing possible events with corresponding Eventcmd commands in OpenBK7231T.

    Added after 8 [minutes]:

    If yo want animation faster/slower, you can change the modulus here to call animation more or less often:

    C code snippet with conditional function and MAX72XX_printRaw call
  • #60 21785623
    p.kaczmarek2
    Moderator Smart Home
    Yes, that's very good, we can merge that. I also see you have some two more drivers, can you present them in guide topics with a brief description on how to run and some photos?

    I can agree to ESP8266 pin changes.

    So far, the only change that is hold and didn't convince me is the Python script for roles - I don't even have Python on my little laptop I use for OBK work during summer. So, let's focus on clock, on new drivers, and on ESP pins for now.
    Helpful post? Buy me a coffee.
📢 Listen (AI):
ADVERTISEMENT