From c58935b7587980cdf16015da5e21b5896c96678e Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Sat, 16 Feb 2019 23:28:14 +0100 Subject: Change RGB LEDs signals and slots to unsigned value. Signed value caused in the conversion incorrect behavior for some corner cases. Signed-off-by: Pavel Pisa --- qtmips_gui/peripheralsview.cpp | 10 +++++----- qtmips_gui/peripheralsview.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'qtmips_gui') diff --git a/qtmips_gui/peripheralsview.cpp b/qtmips_gui/peripheralsview.cpp index 655b101..8ce82fc 100644 --- a/qtmips_gui/peripheralsview.cpp +++ b/qtmips_gui/peripheralsview.cpp @@ -43,8 +43,8 @@ void PeripheralsView::setup(const machine::PeripSpiLed *perip_spi_led) { ui->labelRgb2->setAutoFillBackground(true); connect(perip_spi_led, SIGNAL(led_line_changed(uint)), this, SLOT(led_line_changed(uint))); - connect(perip_spi_led, SIGNAL(led_rgb1_changed(int)), this, SLOT(led_rgb1_changed(int))); - connect(perip_spi_led, SIGNAL(led_rgb2_changed(int)), this, SLOT(led_rgb2_changed(int))); + connect(perip_spi_led, SIGNAL(led_rgb1_changed(uint)), this, SLOT(led_rgb1_changed(uint))); + connect(perip_spi_led, SIGNAL(led_rgb2_changed(uint)), this, SLOT(led_rgb2_changed(uint))); led_line_changed(0); led_rgb1_changed(0); @@ -63,7 +63,7 @@ void PeripheralsView::led_line_changed(uint val) { ui->lineEditBin->setText(t + s); } -static void set_widget_background_color(QWidget *w, int val) { +static void set_widget_background_color(QWidget *w, uint val) { int r = (val >> 16) & 0xff; int g = (val >> 8) & 0xff; int b = (val >> 0) & 0xff; @@ -73,7 +73,7 @@ static void set_widget_background_color(QWidget *w, int val) { w->setPalette(pal); } -void PeripheralsView::led_rgb1_changed(int val) { +void PeripheralsView::led_rgb1_changed(uint val) { QString s, t; s = QString::number(val, 16); t.fill('0', 8 - s.count()); @@ -82,7 +82,7 @@ void PeripheralsView::led_rgb1_changed(int val) { set_widget_background_color(ui->labelRgb1, val); } -void PeripheralsView::led_rgb2_changed(int val) { +void PeripheralsView::led_rgb2_changed(uint val) { QString s, t; s = QString::number(val, 16); t.fill('0', 8 - s.count()); diff --git a/qtmips_gui/peripheralsview.h b/qtmips_gui/peripheralsview.h index 30e85f1..b718d9a 100644 --- a/qtmips_gui/peripheralsview.h +++ b/qtmips_gui/peripheralsview.h @@ -21,8 +21,8 @@ public: public slots: void led_line_changed(uint val); - void led_rgb1_changed(int val); - void led_rgb2_changed(int val); + void led_rgb1_changed(uint val); + void led_rgb2_changed(uint val); private: Ui::PeripheralsView *ui; -- cgit v1.2.3