Ast7 Posted July 5, 2020 Posted July 5, 2020 This post to share some MODdings that can be done to the Powered Up Android APP interface (Create mode with controller). I searched the forum but didn't find a similar post. With the actual version, it's possible to change the size and positions of the widgets, and mix on the same interface the widgets of the 2 controllers It's even possible to add the widgets of the Play mode controllers (Te trains and Batman), and access more code blocks. So theorically, it should be possible to control several trains/cars with one interface. After creating a new project with controller, go to "/android/data/com.lego.common.poweredup/files/Activities/<xxxxxxxx>/" to find the associated files (if you open the metadata.json file you can verify in the "name" if it's the right project) In the "playCanvas.json" file there's all the actual widgets, identified by their "widgetId", with their positioning informations. It's then possible to add/modify them, and restart each time the App to see the results. To find out the widgetId, you can create a new project with the other controller and open it's "playCanvas.json" file (the positioning should hint on the concerned widgets). To exploit the added widgets, we need their associated code blocks. For that, in the powered-up-metadata.json file, replace the "Controller" value by "00000000-0000-0000-0000-000000000000". Thus, the palette.json file will be used to display the needed code blocks by replacing "/widgets/widget-(.+)-block-(5[5-9])" or "/widgets/widget-(.+)-block-(3[7-8])" by "/widgets/.*" The App has to be restarted after the modifications. To go further and use the Play mode widgets, you can search the widgetId in their playCanvas.json files at "/android/data/com.lego.common.poweredup/files/PredefinedActivities/<xxxxxxxx>/" and change the playCanvas.son as above, and do those modifications in the "palette.json" file : - add the following at the end of "TabDefinitions" : {"Name": "Dev", "HexColor": "CompositeBlock3"} This will add new category "Dev" in the code blocks - in "contents", disable all the blocks with "null", and add the following at its end : {"Field": "TypeName", "Value": ".*", "Tab": "Dev"} After App restart, a new tab (red) will appear with new code blocks. The ones to use has the same icons as the global variables but are orange with a red "P" written on them. The parameter to use is the widgetId. Don't consider this as a tutorial as it needs some clarifications and I surely miss other informations. Also, this may not work with the comming versions of the App Quote
Lok24 Posted July 5, 2020 Posted July 5, 2020 Thanks, very interesting, I'm just working on the same topic. Quote
GianCann Posted July 5, 2020 Posted July 5, 2020 In the past I have also done some experiments of this kind. I'll take a look at your information. Thank you ;) Quote
Gimmick Posted July 5, 2020 Posted July 5, 2020 1 hour ago, Ast7 said: and do those modifications in the "palette.json" file : - add the following at the end of "TabDefinitions" : {"Name": "Dev", "HexColor": "CompositeBlock3"} This will add new category "Dev" in the code blocks - in "contents", disable all the blocks with "null", and add the following at its end : {"Field": "TypeName", "Value": ".*", "Tab": "Dev"} After App restart, a new tab (red) will appear with new code blocks. The ones to use has the same icons as the global variables but are orange with a red "P" written on them. The parameter to use is the widgetId. Don't consider this as a tutorial as it needs some clarifications and I surely miss other informations. Also, this may not work with the comming versions of the App Thx, the Dev Tab was new tor me =) So multiple guys all around the world thought the same thing.. xD You can easily add all available widgets to the GUI and use it. There are also code blocks for absolute positioning for the technic motors, "port scanning" etc... One thing that I was unable to get up and running: same widget several times with different channels. That would solve a lot of problems. Quote
Ast7 Posted July 5, 2020 Author Posted July 5, 2020 58 minutes ago, Gimmick said: You can easily add all available widgets to the GUI and use it. There are also code blocks for absolute positioning for the technic motors, "port scanning" etc... One thing that I was unable to get up and running: same widget several times with different channels. That would solve a lot of problems. Yes, some blocks could be interesting for advanced coding (didn't test them yet) I also tried to add the same widget but it was just ignored. Even Lego used 2 different widgets for sliders with the design, so may be it's not possible Quote
Gimmick Posted July 20, 2020 Posted July 20, 2020 Does anyone know what the orange "generic IO something" with 3 inputs does? It seems to read data from the ports: (A,3,0) is something like the angular motor position from the motor on port A. But what are the possible inputs here? Quote
GianCann Posted July 20, 2020 Posted July 20, 2020 @Gimmick can you give me a picture of this block? Quote
Gimmick Posted July 20, 2020 Posted July 20, 2020 9 minutes ago, GianCann said: @Gimmick can you give me a picture of this block? The orange/right one. Ignore the "-1", I just took a screenshot without connecting anything. Quote
GianCann Posted July 20, 2020 Posted July 20, 2020 @Gimmick I tried to get "Dev tab" but without success. Can you tell me some other details to obtain it? Quote
GianCann Posted July 20, 2020 Posted July 20, 2020 3 hours ago, Gimmick said: Does anyone know what the orange "generic IO something" with 3 inputs does? First par: Port Second par: Mode (each device has many mode) Third par: I think that is the dataset. Some sensor, like the Color and Distance sensore return more than one single value with some mode. I need to investigate better. Take a look here: https://github.com/pybricks/technical-info/blob/master/uart-protocol.md Quote
Gimmick Posted July 20, 2020 Posted July 20, 2020 @GianCann Thank you :) So for XL motor on Port A: A,1,0 = speed A,2,0 = angle A,3,0 = abs angle <- strange values I realy hope there will be a new PU version directly on august 1. atleast with support for the new "angular motor" in the 42114 :< Quote
Gimmick Posted July 29, 2020 Posted July 29, 2020 Hmm, does anyone else has the effect, that new PU-profiles are not visible in ...\Activities anymore? If I create and paste a profile I created by hand it still shows up in PU, but if I create a new profile in the PU-App nothing new is visible in the windows file explorer. Even a search for new files shows nothing. Quote
Lok24 Posted July 30, 2020 Posted July 30, 2020 Hi, What do you mean: "Profile"? A program newly defined under "Create"? They are still there, but all changes (add, delete) aren't visible without disconnecting and reconnecting USB (Samsung Galaxy Tablet) Quote
Gimmick Posted July 30, 2020 Posted July 30, 2020 @Lok24 omg... you are right :D I refreshed everything, reconnected the device in my "PU-Profilemanager",... but did not reconnect the USB... Quote
Gimmick Posted September 3, 2020 Posted September 3, 2020 In V 3.4.0 is a new predefined activity "custom control" with a new grid-background and a teasing thumbnail. No functionality currently, but it seems that next release might be interesting. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.