Merge pull request #32 from bobbycar-graz/31-fix-all-code-warnings

Fixed warnings
This commit is contained in:
2020-05-30 16:01:47 +02:00
committed by GitHub
5 changed files with 9 additions and 7 deletions

View File

@@ -26,6 +26,8 @@ build_unflags =
build_flags =
-std=gnu++17
-O3
-Werror
-Wall
-DUSER_SETUP_LOADED=1
-DLOAD_GLCD=1
-DLOAD_FONT2=1

View File

@@ -31,7 +31,7 @@ bool send6Bit(int zhen_tou, int address, int data)
const auto sent = bluetoothSerial.write(buffer, 6);
if (sent != 6)
Serial.printf("send: %lu\r\n", sent);
Serial.printf("send: %u\r\n", sent);
return sent == 6;
}
@@ -53,7 +53,7 @@ void update()
const auto read = bluetoothSerial.readBytes(buffer, 140);
if (read != 140)
{
Serial.printf("bms read buffer too short %lu\r\n", read);
Serial.printf("bms read buffer too short %u\r\n", read);
for (int i = 0; i < read; i++)
Serial.printf("%i ", buffer[i]);

View File

@@ -105,7 +105,7 @@ uint8_t StarfieldDisplay::rng()
zx++;
za = (za^zc^zx);
zb = (zb+za);
zc = (zc+(zb>>1)^za);
zc = (zc+(zb>>1))^za;
return zc;
}
}

View File

@@ -59,13 +59,13 @@ void initWebserver()
if (auto constCurrentDisplay = static_cast<const Display *>(currentDisplay))
{
if (const auto *textInterface = currentDisplay->asTextInterface())
if (const auto *textInterface = constCurrentDisplay->asTextInterface())
{
HtmlTag h2Tag{"h2", content};
content += textInterface->text();
}
if (const auto *menuDisplay = currentDisplay->asMenuDisplay())
if (const auto *menuDisplay = constCurrentDisplay->asMenuDisplay())
{
HtmlTag ulTag{"ul", content};
@@ -81,7 +81,7 @@ void initWebserver()
i++;
});
}
else if (const auto *changeValueDisplay = currentDisplay->asChangeValueDisplayInterface())
else if (const auto *changeValueDisplay = constCurrentDisplay->asChangeValueDisplayInterface())
{
content += "<form action=\"/setValue\" method=\"GET\">";
content += "<input type=\"number\" name=\"value\" value=\"" + String{changeValueDisplay->shownValue()} + "\" />";

View File

@@ -74,7 +74,7 @@ void Graph<LENGTH, COUNT>::redraw(const std::array<std::reference_wrapper<const
template<size_t LENGTH, size_t COUNT>
void Graph<LENGTH, COUNT>::render(const std::array<std::reference_wrapper<const ring_buffer<float, LENGTH>>, COUNT> &buffers, bool delta)
{
float min, max;
float min{std::numeric_limits<float>::quiet_NaN()}, max{std::numeric_limits<float>::quiet_NaN()};
bool first{true};
for (const ring_buffer<float, LENGTH> &buffer : buffers)
{