Can't get M5Stack to work properly



  • The monitor the glucose level of my niece, I set up the entire Miao-Miao to phone to Nighscout routine. The data is collected and viewable on the webpage now.
    However, when I comes to actually setting up the M5stack, I got stuck.

    I tried using it with UIFlow, but the stack itself doesn't want to enter setup and doesn't show up any API key, nor can I set up the wireless connection. I tried following the setup guide, but it does not react to pressing/holing specific bottuns. Note that it did not come with a microSD card.

    Then I tried using Arduino. After a LOT of of issues I managed to get the HelloWord and FactoryTest examples to upload and diaply. But that's it. It is useless without connecting o Nightscout and getting the glucose levels to display (and I haven't noticed any example of code to display that)

    Anyone have any suggestions as to what to do next?



  • If you have used the arduino then you will need to burn the UIFlow firmware to the stack because arduino wipes the firmware from the core



  • @ajb2k3 Thanks. I finally managed to to connect it to my Wi-Fi and the UIFlow.
    Now the final question - how to actually get it to display glucose level and Nightscout data?

    I cannot seem to find an app or code to upload to m5 stack for that.
    Nor can I find anything in the already present app or settings.

    I do have a .ini file with the basic settings (and nightscou site info, SSD data, etc..), but no microSD card.



  • @JustSomeGuy

    @Chris-0 did a project for Nightscout here



  • @world101
    I tried that one the second I got UIFlow connection working.
    Downloaded, unpacked, but UIFlow doesn't want to load it, so how can I put it on the M5Stack?



  • @justsomeguy

    The issue with @Chris-0's program is because m5stack changed the screen brightness block in recent firmware versions and Chris has not updated it yet on his GitHub repo. Looking at the Chrome developer console when loading the program into uiFlow, I see this...

    TypeError: Unknown block type: screen_set_core_brightness
        at Blockly.BlockSvg.Blockly.Block (scripts.818b820f5fb58046033f.js:1)
        at new Blockly.BlockSvg (scripts.818b820f5fb58046033f.js:1)
        at Blockly.WorkspaceSvg.newBlock (scripts.818b820f5fb58046033f.js:1)
        at Object.Blockly.Xml.domToBlockHeadless_ (scripts.818b820f5fb58046033f.js:1)
        at Object.Blockly.Xml.domToBlockHeadless_ (scripts.818b820f5fb58046033f.js:1)
        at Object.Blockly.Xml.domToBlockHeadless_ (scripts.818b820f5fb58046033f.js:1)
        at Object.Blockly.Xml.domToBlockHeadless_ (scripts.818b820f5fb58046033f.js:1)
        at Object.Blockly.Xml.domToBlockHeadless_ (scripts.818b820f5fb58046033f.js:1)
        at Object.Blockly.Xml.domToBlockHeadless_ (scripts.818b820f5fb58046033f.js:1)
        at Object.Blockly.Xml.domToBlockHeadless_ (scripts.818b820f5fb58046033f.js:1)
    

    The block changed from screen_set_core_brightness to screen_set_brightness. I fixed the file for you and now it loads properly in the online uiFlow IDE v1.6.2. You can find the modified file here.



  • @world101 UI flow doesn't want to load the file. No error or nothing. Just a blank screen like I did nothing.

    alt text

    I don't understand why it's not loading or retruning anything. Not even an error message.
    Any other way to get a program to M5stack?



  • Works for me...
    0_1597772432379_Screen Shot 2020-08-18 at 1.40.14 PM.png

    Can you try the Chrome browser and turn on the developer console to see what error it's throwing? Also, did you try the beta uiFlow v1.6.2?

    Another way is to copy this python file to your device and place it in the /flash/apps folder. Then after boot up, go to App and select M5Scout-fixed.py from the App List. Don't forget to change the wifi ssid and password before copying the file to your device.



  • For reference, here is a picture of the error in the Chrome developer console on the original (non-fixed) file...

    Turn the developer console on:
    0_1597774966878_Screen Shot 2020-08-18 at 2.05.08 PM.png

    After I open the file in uiFlow:
    0_1597774905251_Screen Shot 2020-08-18 at 2.19.33 PM.png

    The file at least loads partially. I'm seeing some blocks, but none of the UI labels are showing up on the UI simulator due to the error. So check the Chrome developer console to see if there are other errors you see.



  • It looks like something else was changed In the UI code.



  • Yup. Managed to upload and changed the wifi and webpage data, but somethnig is still screwy.

    No glucose display, the only thing all 3 bottuns affect is screen brightness.

    basically my screen displays:

    SGVIabel (in big letters with DiffSCVI over it)
    datalabel
    screen brghtness
    direction label

    and nothing I press or do does anything. Wifi did connect and webpage data is correct.



  • Anyone knows what the issue is this time?



  • @justsomeguy

    It's still working for me. What region of the world are you are in?
    Can you access the data with a browser? https://tillierscout.herokuapp.com/api/v1/entries?count=1



  • "SGVIabel (in big letters with DiffSCVI over it"

    This usully means that you have the same label set for both out puts or the same screen location for both labels.



  • @world101 Yours? Yes. But I'm accessing the nightscout for my niece: https://lmnightscout.herokuapp.com/api/v1/entries?count=1

    Region is Europe, Croatia to be more precise



  • @justsomeguy

    Ah, okay. It's not actually my data. It is Chris-O's (author of the program). I thought you were still trying to get the app working with Chris' API and couldn't access his data feed (due to some firewall blocking issue, geolocation blocking, etc.).

    Let me see if I can figure out how to get his program working with your niece's data feed. Her feed seems to be only missing the dateString, but I'm not sure he's using that anyway. I'm curious though, what does "Tomato" mean in her data feed? Chris' data feed has "share2" at the end.



  • @justsomeguy

    I got it working now with her data feed and also made a few improvements to the program. Here you go:
    uiFlow file
    MicroPython file

    Don't forget to change the wifi settings before running on the device.



  • Seems to work now.

    Just one final question - how do I get the values in mmol (as they are on the Nightscout).
    I assume it's the SVG value and I saw no conversion in the code itself, which means the SVG is the value in whatever units are used in the US?

    Can I just edit a line like this (bolded is changed):
    SGVlabel.setText(str((str('') + str(round(sgv / 18),1))))

    Also, I see no alarm sounding in the code, so I added
    speaker.sing(240, 10/16)
    right under the svg value check for color. Can anyone tell me what the two values represent? I want it really loud.



  • @justsomeguy said in Can't get M5Stack to work properly:

    Seems to work now.

    Just one final question - how do I get the values in mmol (as they are on the Nightscout).
    I assume it's the SVG value and I saw no conversion in the code itself, which means the SVG is the value in whatever units are used in the US?

    Can I just edit a line like this (bolded is changed):
    SGVlabel.setText(str((str('') + str(round(sgv / 18),1))))

    Yes. Chris-O's dashboard displays the SVG value in mg/dL and it looks like the conversion between mg/dL and mmol/L is to divide mg/dL by 18. So you got it.

    Also, I see no alarm sounding in the code, so I added
    speaker.sing(240, 10/16)
    right under the svg value check for color. Can anyone tell me what the two values represent? I want it really loud.

    speaker.sing(frequency, beats) where beats are: 1/16, 1/8, 1/4, 1/2, 1, 2, or 4
    you could also do speaker.tone(frequency, duration) where duration is time in milliseconds

    For loudness you want speaker.setVolume(int) where int is 0 (no sound) to 1 (full/highest volume). 0.5 is half volume.



  • Well,...

    I got everything working...and then I accidently hit ERASE in M5 Burner (ended up uploading a dozen different version of the app trying to get it to work, and read that you only delete apps trough the burner) and now the entire thing is DEAD, doens't react to anything anymore.


    I have no words.