Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Power saving mode #306

Merged
merged 9 commits into from
Jan 10, 2024
Merged

Power saving mode #306

merged 9 commits into from
Jan 10, 2024

Conversation

elral
Copy link
Collaborator

@elral elral commented Jan 4, 2024

Description of changes

Adding a function to enable custom devices to enter or leave power saving mode.
If the PowerSavingMode should be entered, a message is sent to the custom device with MessageID = -2 and Message = "1"
If the PowerSavingMode should be leaved, a message is sent to the custom device with MessageID = -2 and Message = "0"

Changes in all custom devices are required to differ between entering and leaving.
This will be done in a separate PR within the CustomDevice Repo.

Fixes #299

@elral elral requested a review from DocMoebiuz as a code owner January 4, 2024 08:25
Copy link

github-actions bot commented Jan 4, 2024

Firmware for this pull request:
Firmware.zip

Copy link

github-actions bot commented Jan 5, 2024

Firmware for this pull request:
Firmware.zip

Copy link

github-actions bot commented Jan 6, 2024

Firmware for this pull request:
Firmware.zip

for (uint8_t i = 0; i < customDeviceRegistered; ++i) {
if (state)
customDevice[i].set(-2, "1");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to have const defines or variables with readable labels for the built-in message ids -1 and -2

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to MESSAGEID_POWERSAVINGMODE

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool! let's do the same for -1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmhm, there is no -1 (Stop of connector)
This message is coming from the connector and directly passed to the custom device.
I see no need to do it here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought it would make it more obvious that it's an internal event. Ideally stop would also come from the firmware as we discussed recently. Stop as message on Board level. On the other hand it's also good to have some flexibility on the App side

Since this is a special event I would still give it a speaking name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmhm, I already changed the -1 to MESSAGEID_POWERSAVINGMODE.
Or do you mean something different?

Copy link
Collaborator

@DocMoebiuz DocMoebiuz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my review comment

Copy link

github-actions bot commented Jan 7, 2024

Firmware for this pull request:
Firmware.zip

Copy link

github-actions bot commented Jan 8, 2024

Firmware for this pull request:
Firmware.zip

Copy link

Firmware for this pull request:
Firmware.zip

@DocMoebiuz DocMoebiuz merged commit 7ee6c9c into MobiFlight:main Jan 10, 2024
1 check passed
@DocMoebiuz DocMoebiuz added the enhancement New feature or request label Jan 10, 2024
@elral elral deleted the power_saving_mode branch January 10, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Propagate PowerSavingMode change to Custom device
2 participants