Skip to content

Commit

Permalink
Feb 25 testing (#83)
Browse files Browse the repository at this point in the history
* Add Debug Screen

* Use Anchors

* Use Pit

* Debug Nav Controller

* hard code visibility

* Mock Model

* Use White

* Set Focus

* set defaults

* Revert Hard Coding Changes

* Connect Mqtt Reception Messsage

* Emit Data Change SIgnal

* Validate State of Charge

* Remove Unecessary Function Call

* Remove Unecessary Configs

* Update On Button Press As Well
  • Loading branch information
Peyton-McKee authored Feb 26, 2024
1 parent d977a90 commit 7dfe46c
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 18 deletions.
8 changes: 3 additions & 5 deletions NERODevelopment/content/App.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick 6.2
import NERO

Expand All @@ -12,10 +11,9 @@ Window {
visible: true
title: "NERO"
FontLoader {
id: webFont
source: "fonts/Roboto-Black.ttf"
}
id: webFont
source: "fonts/Roboto-Black.ttf"
}

NavigationController {}
}

2 changes: 1 addition & 1 deletion NERODevelopment/content/HomeMenuItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Rectangle {
color: 'transparent'
border.width: highlighted ? 2 : 1

border.color: highlighted ? "lightsteelblue" : "transparent"
border.color: highlighted ? "white" : "transparent"
height: label.implicitHeight
width: parent.width

Expand Down
5 changes: 2 additions & 3 deletions NERODevelopment/content/NavigationController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import NERO

Item {
id: navigation
width: parent.width
height: parent.height
anchors.fill: parent
focus: !isSelected
property int selectedPageIndex: navigationController.selectedPageIndex
property bool isSelected: navigationController.isSelected
Expand Down Expand Up @@ -35,7 +34,7 @@ Item {
}

Column {
visible: !isSelected
visible: !navigation.isSelected
anchors.fill: parent
anchors.leftMargin: 8
anchors.rightMargin: 8
Expand Down
2 changes: 0 additions & 2 deletions NERODevelopment/content/Pit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ Rectangle {
property int iconWidth: 40
property int iconHeight: 90
property int labelVerticalSpacing: 10
width: 800
height: 480
color: 'black'

RowLayout {
Expand Down
2 changes: 2 additions & 0 deletions NERODevelopment/src/controllers/debugtablecontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void DebugTableController::downButtonPressed() {
if (this->m_scrollingTopics) {
if (this->m_selectedTopicsIndex < this->m_topics.length() - 1) {
this->setSelectedTopicsIndex(this->m_selectedTopicsIndex + 1);
this->update();
}
} else {
if (this->m_selectedValuesIndex < this->m_selectedValues.length() - 1) {
Expand All @@ -82,6 +83,7 @@ void DebugTableController::upButtonPressed() {
if (this->m_scrollingTopics) {
if (this->m_selectedTopicsIndex != 0) {
this->setSelectedTopicsIndex(this->m_selectedTopicsIndex - 1);
this->update();
}
} else {
if (this->m_selectedValuesIndex != 0) {
Expand Down
4 changes: 2 additions & 2 deletions NERODevelopment/src/controllers/navigationcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public slots:
void homeButtonPressed() override;

private:
bool m_isSelected;
int m_selectedPageIndex;
bool m_isSelected = false;
int m_selectedPageIndex = 0;
int m_numPages = 3;
};

Expand Down
4 changes: 2 additions & 2 deletions NERODevelopment/src/controllers/offviewcontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public slots:
float m_packTemp;
float m_motorTemp;
float m_stateOfCharge;
int m_selectedFlowIndex;
bool m_didSelect;
int m_selectedFlowIndex = 0;
bool m_didSelect = 0;
QString m_selectedName;
QString m_selectedDescription;
QString m_selectedUrl;
Expand Down
2 changes: 1 addition & 1 deletion NERODevelopment/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ int main(int argc, char *argv[]) {

if (osName == "raspberrypi-sta") {
model = new RaspberryModel;
model->connectToMQTT();
} else {
model = new MockModel;
}
Expand All @@ -54,7 +55,6 @@ int main(int argc, char *argv[]) {
},
Qt::QueuedConnection);

engine.rootContext()->setContextProperty("model", model);
engine.rootContext()->setContextProperty("homeController", &homeController);
engine.rootContext()->setContextProperty("offViewController",
&offViewController);
Expand Down
1 change: 0 additions & 1 deletion NERODevelopment/src/models/mqtt_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ void MqttClient::brokerConnected() {

void MqttClient::receiveMessage(const QByteArray &message,
const QMqttTopicName &topic) {

serverdata::ServerData serverData;

bool success = m_serializer.deserialize(&serverData, message);
Expand Down
1 change: 1 addition & 0 deletions NERODevelopment/src/models/raspberry_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ void RaspberryModel::connectToMQTT() {
void RaspberryModel::receiveServerData(const serverdata::ServerData data,
const QString topic) {
this->currentData[topic] = DataInfo(topic, data.unit(), data.values());
emit this->onCurrentDataChange();
}

std::optional<float> RaspberryModel::getMph() {
Expand Down
2 changes: 1 addition & 1 deletion NERODevelopment/src/utils/data_type_names.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define DIRECTION "direction"
#define PACKTEMP "bms/temps/packtemp"
#define MOTORTEMP "bms/temps/motortemp"
#define STATEOFCHARGE "stateofcharge"
#define STATEOFCHARGE "BMS/Pack/SOC"
#define CURRENT "current"
#define BALANCINGCELLS "balancingcells"
#define PACKVOLTAGE "packvoltage"
Expand Down

0 comments on commit 7dfe46c

Please sign in to comment.