Skip to content

Instantly share code, notes, and snippets.

@kotobuki
Last active October 20, 2023 08:58
Show Gist options
  • Save kotobuki/aab0a8b0e65e501c8a354198bdc4d969 to your computer and use it in GitHub Desktop.
Save kotobuki/aab0a8b0e65e501c8a354198bdc4d969 to your computer and use it in GitHub Desktop.

This code works fine with the UIFlow_Lite firmware versions between v1.7.5 and v1.9.6. However, the HTTP request fails with versions after v1.9.7, including v.12.2. If I change the URL to http://api.m5stack.com/v1, it also works fine with those versions. It seems that firmware versions after v1.9.7 only accept the URL for GET HTTP requests.

  • Atom Lite
  • UIFlow v.12.2
{"components":[],"type":"atom","versions":"Beta","units":[],"hats":[],"stamps":[],"blockly":"<block type=\"basic_on_setup\" id=\"setup_block\" deletable=\"false\" x=\"230\" y=\"50\"><next><block type=\"uart\" id=\"Lx^*$2=]kCNj9_au}YA+\"><field name=\"VAR\">uart1</field><field name=\"BAUD\">115200</field><field name=\"USE_TIMER\">1</field><value name=\"TX\"><shadow type=\"math_slider\" id=\"AEN)/Kxzh-y1R@(V/}Iq\"><field name=\"NUM\" max=\"34\" step=\"1\">1</field></shadow></value><value name=\"RX\"><shadow type=\"math_slider\" id=\",caE[k$1*KBgWb;_^jx5\"><field name=\"NUM\" max=\"36\" step=\"1\">3</field></shadow></value><next><block type=\"http_request\" id=\"tzpkW=CNl75RHv;*$^@W\"><field name=\"method\">GET</field><value name=\"url\"><shadow type=\"text\" id=\"}i+ha!+aVRUkZ9s.1@`j\"><field name=\"TEXT\">https://api.open-meteo.com/v1/forecast?latitude=35.6895&amp;longitude=139.6917&amp;current_weather=true</field></shadow></value><value name=\"headers\"><block type=\"map_on_loop\" id=\"{IFcFYmJG7K|iSPR-i4F\"><statement name=\"LOOP\"><block type=\"create_map_key\" id=\"pvObaaRo0odEy)(j]{ay\"><value name=\"key\"><block type=\"text\" id=\"^3xEG4cB!z]e(6t-$WEC\"><field name=\"TEXT\">Content-Type</field></block></value><value name=\"value\"><block type=\"text\" id=\":3QV^U!84u$h9Ue/U+p1\"><field name=\"TEXT\">text/html</field></block></value></block></statement></block></value><value name=\"data\"><block type=\"map_on_loop\" id=\"YS3|A?==r`/HsP$I?r;]\"></block></value><statement name=\"success\"><block type=\"rgb_set_all_input\" id=\"$x4J}?#`/daUHR7~1_FT\"><value name=\"COLOR\"><block type=\"color_rgb_palette\" id=\"C|6gT!|7!Aj#o~}#Ts(]\"><mutation mode=\"palette\"></mutation><field name=\"MODE\">palette</field><field name=\"COLOR\">#33ff33</field></block></value><next><block type=\"uart_write_line\" id=\"Yzos+)IM_+VN4?7Cx3SV\"><field name=\"VAR\">uart1</field><value name=\"VALUE\"><shadow type=\"text\" id=\"Xos@A|pl]e4n+Ie/]^#T\"><field name=\"TEXT\">Success</field></shadow></value><next><block type=\"uart_write_line\" id=\"_3=(Gb@rnO`9=!_C0;8v\"><field name=\"VAR\">uart1</field><value name=\"VALUE\"><shadow type=\"text\" id=\"No`75dji5|p*Fd*_DS@|\"><field name=\"TEXT\">OK</field></shadow><block type=\"get_data\" id=\"$0Zn4nt|V*cGFAn2MUZa\"></block></value></block></next></block></next></block></statement><statement name=\"fail\"><block type=\"rgb_set_all_input\" id=\"9D)%?o?f$#be~6LW4{C_\"><value name=\"COLOR\"><block type=\"color_rgb_palette\" id=\"BDGp5_h?K`5YIKa98^*W\"><mutation mode=\"palette\"></mutation><field name=\"MODE\">palette</field><field name=\"COLOR\">#ff0000</field></block></value><next><block type=\"uart_write_line\" id=\"oo^B/D3{1$.`f(+~uOS:\"><field name=\"VAR\">uart1</field><value name=\"VALUE\"><shadow type=\"text\" id=\"D?ee+SULin?Jog$(7t@/\"><field name=\"TEXT\">Fail</field></shadow></value></block></next></block></statement></block></next></block></next></block>","Blockly.Remotes":[],"Blockly.RemotePlus":[{"id":"__title","blockId":"","createTime":1691190784360,"name":"M5RemoteTitle","dragAndDrop":false,"resizable":false,"options":{"minWidth":1,"minHeight":1,"maxWidth":6,"maxHeight":10,"defaultWidth":2,"defaultHeight":1},"w":2,"h":1,"bgColor":"#0080FF","color":"#fff","fontsize":"M","label":"M5Remote","interval":3000,"code":"","event":"","dataSource":"none","ezdataToken":"SIDJQXV2VZtGhGzNH17UVnHK7SYHFmwY","topic":"","needShadow":false,"type":"title","x":null,"y":null}],"modules":["rgb","machine"],"cbIdList_":[],"eventCBIdList_":[],"apikey":"","uuid":""}
@kotobuki
Copy link
Author

kotobuki commented Aug 5, 2023

uiflow_block_1691196143657

@pandiannano
Copy link

Hi, Are you using "Run" mode or "Download" mode? Wi-Fi must be configured if using "Download" mode
image

@kotobuki
Copy link
Author

kotobuki commented Aug 7, 2023

Hi, Are you using "Run" mode or "Download" mode? Wi-Fi must be configured if using "Download" mode

@pandiannano
Thanks for your comment. I tried in “Run” mode.

@pandiannano
Copy link

pandiannano commented Aug 21, 2023

@kotobuki Hi, Please Try this code again and check the serial monitor and show serial output if error occurs

Screenshot from 2023-08-21 14-17-15
Screenshot from 2023-08-21 14-07-50

@kotobuki
Copy link
Author

@pandiannano
Thank you very much for reporting. I reverted to v1.12.3 and tried running three times. The log was like this.

Fail
Fail
Fail

To make sure, "this code" is the same as my first post? Or did you modify it somewhere? If you modified it, please let me know the difference from the original version.

@kotobuki
Copy link
Author

@pandiannano
I confirmed that this issue is still reproducible with v1.12.6. The output in the serial monitor was the same.

To make sure, did you change anything from my code, or have you tried with the same code? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment