Skip to content

Freeing up more space on Move hub #523

Closed

Description

@dlech

Move hub is once again dangerously close (less than 500 bytes) to running out of flash memory for the firmware. So, we need to come up with more ideas to free up space.

Activity

  1. added
    hub: movehub
    software: pybricks-micropython
    on Nov 8, 2021
  2. dlech commented on Nov 8, 2021

    @dlech
    MemberAuthor

    Idea: disable WeDo 2.0 and/or SPIKE I/O devices.

    The recent ColorLightMatrix class added 500 bytes. So if each of these devices is in that ballpark, this could potentially save 1-3k (for up to 6 device classes).

    For motors, probably only the tuning data is different since they all share a common class, so removing those would probably would only make a small difference.

  3. laurensvalk commented on Nov 8, 2021

    @laurensvalk
    Member

    pybricks/pybricks-micropython@7dd84a3 seems much larger (+1K) than I expected, so I'll need to have a look at that one.

    pbio_trajectory_stretch += 572
    pbio_drivebase_curve += 204
    pybricks.robotics.DriveBase.curve = +192
    
  4. laurensvalk commented on Nov 8, 2021

    @laurensvalk
    Member

    Idea: disable keyword arguments on Move Hub. Since we use macros for all of them, maybe we can change those for Move Hub, perhaps without changing all the classes. To gain the full benefit we'd also need to change the function object definitions, so this is probably a bit more work than it's worth.

  5. laurensvalk commented on Nov 9, 2021

    @laurensvalk
    Member

    pybricks/pybricks-micropython@7dd84a3 seems much larger (+1K) than I expected

    Managed to cut it by 508 bytes. Combined with your 320 byte savings for the firmware info, we might have a little longer to go.

    But if we have to:

    Idea: disable WeDo 2.0 and/or SPIKE I/O devices.

    From a functionality and savings point of view, we could perhaps start with the SPIKE Color Sensor and SPIKE Ultrasonic Sensor since distance and color sensing is provided by the ColorDistanceSensor.

    They should also give the biggest gain as we also get to cut the Common.LightArray class used for their built-in lights.

    The ColorLightMatrix might still be somewhat nice to keep, since it does have nice use cases in system/city applications.

  6. laurensvalk commented on Nov 18, 2021

    @laurensvalk
    Member

    Idea: disable the Control() class on motors and drive bases.

    Really, the defaults will do fine for most cases.

    One downside is that control.stalled and control.done would no longer be available so multi-motor control would be a bit harder. These are already being flattened in the DriveBase case, so maybe it makes sense to do that for Motor as well.

  7. laurensvalk commented on Dec 21, 2021

    @laurensvalk
    Member

    Disabling Motor.control, Motor.log, and the corresponding control and log objects in DriveBase saves about 2800 bytes, which should keep us going for a little while longer.

  8. dlech commented on Dec 22, 2021

    @dlech
    MemberAuthor

    FYI, pybricks/pybricks-micropython@44ee268 breaks our R2-D2 example program since is uses drive.distance_control.limits().

  9. laurensvalk commented on Dec 22, 2021

    @laurensvalk
    Member

    I’d need to have a closer look tomorrow, but I think the limits() call here has become redundant anyway. Just the settings() call should suffice, and we’re keeping that one.

  10. c59-zurich commented on Dec 29, 2021

    @c59-zurich

    Hello, thank you for developing this very useful tool!
    I'm new to the community and not a coding expert. What if, like for the option to download the program together with the firmware, there is an option on which firmware blocks to include in the firmware to download? This way you could save memory when downloading not needed firmware blocks knowing of course that the developing platform is not complete anymore for new developments....
    Is there also a way to make a program autostart just to start the downloaded program right when powering up?
    This way you could make "permanent final programs" which uses less memory as they are not intended for development anymore.
    If you need do develop a new program then you reinstall the full firmware and start the program with the play icon.
    Even nicer would it be if you could determine which firmware blocks to download automatically by downloading of the firmware+program operation.
    Kind regards

  11. dlech commented on Dec 29, 2021

    @dlech
    MemberAuthor

    What if, like for the option to download the program together with the firmware, there is an option on which firmware blocks to include in the firmware to download?

    This is probably too complicated. We would have to build a separate firmware for each combination of features. Pro users can download the source code and do this themselves though.

    Is there also a way to make a program autostart just to start the downloaded program right when powering up

    No, this isn't possible. However, it only takes one extra press of the button to start the program.

  12. c59-zurich commented on Jan 12, 2022

    @c59-zurich

    The problems with the poor lego BOOST move hub memory are really limiting the possibility of implementing meaningful programs with this device, especially when considering a pybricks firmware that supports all possible devices. If considering reducing the amount of supported peripheric devices there seem not to be a Tecnical objective choice on which peripheric device to support and which not. As the lego BOOST move hub memory is really limited my suggestion is to limit the supported peripheric devices to the standard lego BOOST set at least to give a consistency on the purchased package which would probably fits to the majority of those who purchased this lego set and giving them the possibility to make meaningful programs.
    Kind regards

  13. dlech commented on Oct 10, 2022

    @dlech
    MemberAuthor

    We have made good progress on freeing up space. There is a more general discussion about the future of move hub at #218.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    hub: movehubsoftware: pybricks-micropython

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions