-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
Added a signalsController.cpp and signalsController.h file. The new signalsController class can check and change the status for different signals
There was a problem hiding this 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
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.
There was a problem hiding this 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
Changed attributeStatus enumerations to raw values. Added Q_Properties for pack temp, motor temp, and state of charge
…rn-Electric-Racing/Nero-2.0 into #46-Update-Controller
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.
There was a problem hiding this 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
Connect model in constructor.
…rn-Electric-Racing/Nero-2.0 into #46-Update-Controller
Move attributeNames to data_type_names file.
Delete attributenames.h file.
…rn-Electric-Racing/Nero-2.0 into #46-Update-Controller
There was a problem hiding this 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.
There was a problem hiding this 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, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful
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