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

#46-Update-Controller #53

Merged
merged 23 commits into from
Feb 2, 2024
Merged

#46-Update-Controller #53

merged 23 commits into from
Feb 2, 2024

Conversation

mliam0608
Copy link
Contributor

@mliam0608 mliam0608 commented Jan 25, 2024

Added a signalsController.cpp and signalsController.h file. The new signalsController class can check and change the status for different signals

Changes

Added a SignalsController class inside the controllers folder.

Notes

I have not tested the code yet.

Closes #46

Added a signalsController.cpp and signalsController.h file. The new signalsController class can check and change the status for different signals
Copy link
Collaborator

@Peyton-McKee Peyton-McKee left a comment

Choose a reason for hiding this comment

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

Good start, Make sure to rename the file to OffViewController

NERODevelopment/src/controllers/signalsController.h Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/signalscontroler.cpp Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/signalsController.h Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/signalscontroler.cpp Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/signalscontroler.cpp Outdated Show resolved Hide resolved
@mliam0608 mliam0608 self-assigned this Jan 25, 2024
I added an AttributeNames header o define possible names for signals as macros. I also added an AttributeStatus header file to define enumeration values for possible statuses. To create a dictionary value for each signal, I created an offViewModel class that assigns a status to a name.
Copy link
Collaborator

@Peyton-McKee Peyton-McKee left a comment

Choose a reason for hiding this comment

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

You should be only making one controller. You need to delete the signals controller if your not using it anymore, also you still need to add pack, motor, state of charge as other q properties. Make sure to tag your commits with the issue number, and also dont make a new model, just ad the function to the current models

NERODevelopment/src/controllers/offViewController.cpp Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/attributeNames.h Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/attributeNames.h Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/attributestatus.h Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/offviewmodel.cpp Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/offviewmodel.h Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/signalsController.h Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/offviewmodel.cpp Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/signalsController.h Outdated Show resolved Hide resolved
NERODevelopment/src/controllers/signalscontroler.cpp Outdated Show resolved Hide resolved
Changed attributeStatus enumerations to raw values. Added Q_Properties for pack temp, motor temp, and state of charge
Update attributeStatus enumerations and add packTemp, stateOfCharge, and motorTemp QProperties to offViewController.
Remove unnecessary efficiencyController.h and chargingController.h imports.
Change packTemp, stateOfCharge, and motorTemp to floats. Introduce a model field for the offViewController class.
Add model import line. Change offViewController constructor to initialize packTemp, motorTemp, and stateOfCharge values. Change updateAttributesFromModel function to properly update attribute statuses.
Copy link
Collaborator

@Peyton-McKee Peyton-McKee left a comment

Choose a reason for hiding this comment

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

you need to connect the model and the controller, and delete the viewmodel attribute, also move the macros to the data_type_name file

Copy link
Collaborator

@Peyton-McKee Peyton-McKee left a comment

Choose a reason for hiding this comment

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

one last thing then you should be good

Added updates for packTemp, motorTemp, and stateOfCharge to updateAttributesFromModel() function.
Copy link
Collaborator

@Peyton-McKee Peyton-McKee left a comment

Choose a reason for hiding this comment

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

You have to add these files to the actual project in the cmakelists.txt file under project sources. Then when you try to build youll see that it fails

OffViewController::OffViewController(Model *model, QObject *parent)
: QObject{parent}, m_packTemp(0.0), m_motorTemp(0.0), m_stateOfCharge(0.0) {
this->m_model = model;
connect(m_model, &Model::updateAttributesFromModel, this,
Copy link
Collaborator

Choose a reason for hiding this comment

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

this compiles? i dont think this function exists in the model, you want the models currentDataDidChange Signal

@@ -0,0 +1,10 @@
#ifndef ATTRIBUTESTATUS_H
Copy link
Collaborator

Choose a reason for hiding this comment

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

move this file to utils

Move attributeStatus.h to utils folder, update offViewController constructor.
Remove attributeStatus.h from the controllers folder.
Copy link
Collaborator

@Peyton-McKee Peyton-McKee left a comment

Choose a reason for hiding this comment

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

Beautiful

@Peyton-McKee Peyton-McKee merged commit d86f63f into Develop Feb 2, 2024
1 check passed
@Peyton-McKee Peyton-McKee deleted the #46-Update-Controller branch February 2, 2024 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Off Screen - Update Controller
2 participants