PaHub Code issue in UIFlow2



  • @m5stack I'm trying to write an example of using the PaHub in UIFlow2 but found a bug:

      env3_0 = ENVUnit(i2c=i2c0, type=3)
      env4_0 = ENVUnit(i2c=PAHUBUnit(i2c=i2c0, channel=0), type=4)
      pahub_0 = PAHUBUnit(i2c=i2c0, channel=0)
    

    Should be:

      env3_0 = ENVUnit(i2c=PAHUBUnit(i2c=i2c0, channel=1), type=3)
      env4_0 = ENVUnit(i2c=PAHUBUnit(i2c=i2c0, channel=0), type=4)
      pahub_0 = PAHUBUnit(i2c=i2c0, channel=0)
    

    but no matter what I try, the Pahub always crashes with "device not found"



  • Hello @ajb2k3

    remember, PaHub and ENVIII share the same I2C address (0x70) by default, e.g. if not modified. As discussed here.

    Thanks
    Felix



  • @felmue said in PaHub Code issue in UIFlow2:

    Hello @ajb2k3

    remember, PaHub and ENVIII share the same I2C address (0x70) by default, e.g. if not modified. As discussed here.

    Thanks
    Felix

    Thanks but I have an issue with solving your code. in the line:
    env3_0 = ENVUnit(i2c=PAHUBUnit(i2c=i2c0, channel=0, address=0x71), type=3)

    You have attached the Address to the ENV but we need to override the pahub_0 definition to include the address or it still looks to address 0x70 and this I can't work out.



  • Hello @ajb2k3

    the additional address parameter is for the PaHub. E.g. I modified the PaHub to use I2C address 0x71 (instead of default address 0x70).

    BTW: ENVIII alternate I2C address is 0x56.

    Thanks
    Felix



  • @felmue said in PaHub Code issue in UIFlow2:

    Hello @ajb2k3

    the additional address parameter is for the PaHub. E.g. I modified the PaHub to use I2C address 0x71 (instead of default address 0x70).

    BTW: ENVIII alternate I2C address is 0x56.

    Thanks
    Felix

    I've changed the Hub address to 71 but the definition is for pahub_0 but you code has env defined as PAHUBUnit
    hence the confusion



  • Hello @ajb2k3

    please find an example in the UIFlow2 Project Zone called M5Dial_PbHub_EnvIII_EnvIV.

    It features an M5Dial, PaHub (modified I2C address 0x71), Env III (channel 0) and Env IV (channel 1).

    M5Dial
       |
    PaHub (0x71) -|
                  |- ch0 - ENV III (0x44, 0x70)
                  |- ch1 - ENV IV (0x44, 0x76)
    

    Is that what you are looking for?

    BTW: my code has env defined as PAHUBUnit because the Env III and Env IV are connected to channel 0 and channel 1 of the PaHub.

    Thanks
    Felix



  • Thanks but just a note for your example, Use the execute code but ad a hash (#) before the note



  • Thanks here we are
    0_1708196918513_Screenshot 2024-02-17 at 19.08.18.png



  • Hello @ajb2k3

    nice! And thanks for the tip with the # before the note.

    Thanks
    Felix