From 634db07be0e35834c5288474484df23d48105af8 Mon Sep 17 00:00:00 2001 From: IseanB Date: Sun, 16 Oct 2022 16:59:08 -0700 Subject: [PATCH 1/6] Testing code --- main.cpp | 4 ++-- mainwindow.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index d8e1bb5..b62ffa7 100644 --- a/main.cpp +++ b/main.cpp @@ -1,14 +1,14 @@ #include "headers/background.h" #include "mainwindow.h" -// #include +#include #include #include int main(int argc, char *argv[]) { - // wiringPiSetup(); + wiringPiSetup(); Background b; b.dark_theme(); QApplication a(argc, argv); diff --git a/mainwindow.cpp b/mainwindow.cpp index e84b2ae..37fb01b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -119,6 +119,8 @@ void MainWindow::gather_info() { blink = !blink; seconds += 1; + + std::cout << "Current Battery Output: " << digitalRead(0) << std::endl; } void MainWindow::on_parkingSignalON_clicked() { gear.switch_gears(PARK); } From 3ba0b6cb8b624c1a85431a51bd290f1d594ebfe0 Mon Sep 17 00:00:00 2001 From: IseanB Date: Sun, 16 Oct 2022 17:03:44 -0700 Subject: [PATCH 2/6] Adding Lib --- DriverInterface.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DriverInterface.pro b/DriverInterface.pro index 3966ad8..55e1cf8 100644 --- a/DriverInterface.pro +++ b/DriverInterface.pro @@ -5,7 +5,7 @@ QT += widgets CONFIG += c++17 -# LIBS += -lwiringPi +LIBS += -lwiringPi # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. From 12b12abbf9310b70b899c44282bf610abdeedff1 Mon Sep 17 00:00:00 2001 From: IseanB Date: Sun, 16 Oct 2022 17:04:52 -0700 Subject: [PATCH 3/6] Adding include --- mainwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index 37fb01b..a5ccd24 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -3,6 +3,7 @@ #include #include #include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { From d5d1ee8a612c6cbc2f048d60f4c136f11b28e5a4 Mon Sep 17 00:00:00 2001 From: IseanB Date: Sun, 16 Oct 2022 17:14:37 -0700 Subject: [PATCH 4/6] asdasd --- mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index a5ccd24..01bc902 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -120,7 +120,7 @@ void MainWindow::gather_info() { blink = !blink; seconds += 1; - + pinMode(0, INPUT); std::cout << "Current Battery Output: " << digitalRead(0) << std::endl; } From d55e00ee9c756ce956499b33c55990f6abb87b0b Mon Sep 17 00:00:00 2001 From: IseanB Date: Sun, 16 Oct 2022 17:46:31 -0700 Subject: [PATCH 5/6] Two buttons --- mainwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 01bc902..d7347a0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -121,7 +121,9 @@ void MainWindow::gather_info() { blink = !blink; seconds += 1; pinMode(0, INPUT); - std::cout << "Current Battery Output: " << digitalRead(0) << std::endl; + pinMode(1, INPUT); + std::cout << "Current Pin 0 Output: " << digitalRead(0) << std::endl; + std::cout << "Current Pin 1 Output: " << digitalRead(1) << std::endl; } void MainWindow::on_parkingSignalON_clicked() { gear.switch_gears(PARK); } From 84f88fcbff166bbd3fa3034c150ca10518e2b8c9 Mon Sep 17 00:00:00 2001 From: IseanB Date: Fri, 21 Oct 2022 13:15:20 -0700 Subject: [PATCH 6/6] Isolating 1 pin reading --- mainwindow.cpp | 5 ++--- sources/battery.cpp | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index d7347a0..bda7e3d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -120,10 +120,9 @@ void MainWindow::gather_info() { blink = !blink; seconds += 1; - pinMode(0, INPUT); - pinMode(1, INPUT); + + pinMode(0, INPUT); std::cout << "Current Pin 0 Output: " << digitalRead(0) << std::endl; - std::cout << "Current Pin 1 Output: " << digitalRead(1) << std::endl; } void MainWindow::on_parkingSignalON_clicked() { gear.switch_gears(PARK); } diff --git a/sources/battery.cpp b/sources/battery.cpp index 340b5d6..3eab75e 100644 --- a/sources/battery.cpp +++ b/sources/battery.cpp @@ -4,6 +4,7 @@ Battery::Battery() : battery_val(100) {} void Battery::setup(QProgressBar *battery_ptr, QLabel *range_label_ptr, QLabel *low_battery_label_ptr, QLabel *battery_label_ptr, QLCDNumber *range_ptr, QLabel *distance_label_ptr, QFrame *battery_line_1_ptr, QFrame *battery_line_2_ptr, QFrame *battery_line_3_ptr, QFrame *battery_line_4_ptr, uint16_t height, uint16_t width) { + battery = battery_ptr; range_label = range_label_ptr; low_battery_label = low_battery_label_ptr;