forked from Makuna/NeoPixelBus
funtional testing (#593)
functional optional moved to common location topology signed warnings cleaned up
This commit is contained in:
@@ -41,10 +41,13 @@ NeoMosaic <MyPanelLayout> mosaic(
|
||||
|
||||
void DumpMosaic()
|
||||
{
|
||||
int16_t totalWidth = static_cast<int16_t>(mosaic.getWidth());
|
||||
int16_t totalHeight = static_cast<int16_t>(mosaic.getHeight());
|
||||
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t\t");
|
||||
for (int x = 0; x < mosaic.getWidth(); x++)
|
||||
for (int16_t x = 0; x < totalWidth; x++)
|
||||
{
|
||||
Serial.print(x);
|
||||
Serial.print("\t");
|
||||
@@ -52,19 +55,19 @@ void DumpMosaic()
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t---");
|
||||
for (int x = 0; x < mosaic.getWidth(); x++)
|
||||
for (int16_t x = 0; x < totalWidth; x++)
|
||||
{
|
||||
Serial.print("--------");
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
for (int y = 0; y < mosaic.getHeight(); y++)
|
||||
for (int16_t y = 0; y < totalHeight; y++)
|
||||
{
|
||||
Serial.print(" ");
|
||||
Serial.print(y);
|
||||
Serial.print("\t|\t");
|
||||
|
||||
for (int x = 0; x < mosaic.getWidth(); x++)
|
||||
for (int16_t x = 0; x < totalWidth; x++)
|
||||
{
|
||||
NeoTopologyHint hint = mosaic.TopologyHint(x, y);
|
||||
|
||||
|
@@ -45,10 +45,13 @@ NeoTiles <MyPanelLayout, MyTilesLayout> tiles(
|
||||
|
||||
void DumpTopo()
|
||||
{
|
||||
int16_t totalWidth = static_cast<int16_t>(tiles.getWidth());
|
||||
int16_t totalHeight = static_cast<int16_t>(tiles.getHeight());
|
||||
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t\t");
|
||||
for (int x = 0; x < tiles.getWidth(); x++)
|
||||
for (int16_t x = 0; x < totalWidth; x++)
|
||||
{
|
||||
Serial.print(x);
|
||||
Serial.print("\t");
|
||||
@@ -56,19 +59,19 @@ void DumpTopo()
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t---");
|
||||
for (int x = 0; x < tiles.getWidth(); x++)
|
||||
for (int16_t x = 0; x < totalWidth; x++)
|
||||
{
|
||||
Serial.print("--------");
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
for (int y = 0; y < tiles.getHeight(); y++)
|
||||
for (int16_t y = 0; y < totalHeight; y++)
|
||||
{
|
||||
Serial.print(" ");
|
||||
Serial.print(y);
|
||||
Serial.print("\t|\t");
|
||||
|
||||
for (int x = 0; x < tiles.getWidth(); x++)
|
||||
for (int16_t x = 0; x < totalWidth; x++)
|
||||
{
|
||||
NeoTopologyHint hint = tiles.TopologyHint(x, y);
|
||||
|
||||
|
@@ -31,10 +31,13 @@ NeoTopology<MyPanelLayout> topo(PanelWidth, PanelHeight);
|
||||
|
||||
void DumpTopo()
|
||||
{
|
||||
int16_t totalWidth = static_cast<int16_t>(topo.getWidth());
|
||||
int16_t totalHeight = static_cast<int16_t>(topo.getHeight());
|
||||
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t\t");
|
||||
for (int x = 0; x < topo.getWidth(); x++)
|
||||
for (int16_t x = 0; x < totalWidth; x++)
|
||||
{
|
||||
Serial.print(x);
|
||||
Serial.print("\t");
|
||||
@@ -42,19 +45,19 @@ void DumpTopo()
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t--");
|
||||
for (int x = 0; x < topo.getWidth(); x++)
|
||||
for (int16_t x = 0; x < totalWidth; x++)
|
||||
{
|
||||
Serial.print("--------");
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
for (int y = 0; y < topo.getHeight(); y++)
|
||||
for (int16_t y = 0; y < totalHeight; y++)
|
||||
{
|
||||
Serial.print(" ");
|
||||
Serial.print(y);
|
||||
Serial.print("\t|\t");
|
||||
|
||||
for (int x = 0; x < topo.getWidth(); x++)
|
||||
for (int16_t x = 0; x < totalWidth; x++)
|
||||
{
|
||||
Serial.print(topo.Map(x, y));
|
||||
Serial.print("\t");
|
||||
|
@@ -27,22 +27,6 @@ License along with NeoPixel. If not, see
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// some platforms do not come with STL or properly defined one, specifically functional
|
||||
// if you see...
|
||||
// undefined reference to `std::__throw_bad_function_call()'
|
||||
// ...then you can either add the platform symbol to the list so NEOPIXEBUS_NO_STL gets defined or
|
||||
// go to boards.txt and enable c++ by adding (teensy31.build.flags.libs=-lstdc++) and set to "smallest code" option in Arduino
|
||||
//
|
||||
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR) || defined(STM32L432xx) || defined(STM32L476xx) || defined(ARDUINO_ARCH_SAM)
|
||||
#define NEOPIXEBUS_NO_STL 1
|
||||
#endif
|
||||
|
||||
// some platforms do not define this standard progmem type for some reason
|
||||
//
|
||||
#ifndef PGM_VOID_P
|
||||
#define PGM_VOID_P const void *
|
||||
#endif
|
||||
|
||||
// '_state' flags for internal state
|
||||
#define NEO_DIRTY 0x80 // a change was made to pixel data that requires a show
|
||||
|
||||
|
@@ -26,6 +26,8 @@ License along with NeoPixel. If not, see
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "internal/NeoUtil.h"
|
||||
|
||||
#if defined(NEOPIXEBUS_NO_STL)
|
||||
|
||||
typedef float(*AnimEaseFunction)(float unitValue);
|
||||
|
@@ -58,7 +58,7 @@ public:
|
||||
uint16_t totalWidth = getWidth();
|
||||
uint16_t totalHeight = getHeight();
|
||||
|
||||
if (x >= totalWidth)
|
||||
if (x >= static_cast<int16_t>(totalWidth))
|
||||
{
|
||||
x = totalWidth - 1;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
x = 0;
|
||||
}
|
||||
|
||||
if (y >= totalHeight)
|
||||
if (y >= static_cast<int16_t>(totalHeight))
|
||||
{
|
||||
y = totalHeight - 1;
|
||||
}
|
||||
@@ -107,7 +107,8 @@ public:
|
||||
uint16_t totalWidth = getWidth();
|
||||
uint16_t totalHeight = getHeight();
|
||||
|
||||
if (x < 0 || x >= totalWidth || y < 0 || y >= totalHeight)
|
||||
if (x < 0 || x >= static_cast<int16_t>(totalWidth) ||
|
||||
y < 0 || y >= static_cast<int16_t>(totalHeight))
|
||||
{
|
||||
return NeoTopologyHint_OutOfBounds;
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ public:
|
||||
uint16_t totalWidth = getWidth();
|
||||
uint16_t totalHeight = getHeight();
|
||||
|
||||
if (x >= totalWidth)
|
||||
if (x >= static_cast<int16_t>(totalWidth))
|
||||
{
|
||||
x = totalWidth - 1;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
x = 0;
|
||||
}
|
||||
|
||||
if (y >= totalHeight)
|
||||
if (y >= static_cast<int16_t>(totalHeight))
|
||||
{
|
||||
y = totalHeight - 1;
|
||||
}
|
||||
@@ -101,7 +101,8 @@ public:
|
||||
uint16_t totalWidth = getWidth();
|
||||
uint16_t totalHeight = getHeight();
|
||||
|
||||
if (x < 0 || x >= totalWidth || y < 0 || y >= totalHeight)
|
||||
if (x < 0 || x >= static_cast<int16_t>(totalWidth) ||
|
||||
y < 0 || y >= static_cast<int16_t>(totalHeight))
|
||||
{
|
||||
return NeoTopologyHint_OutOfBounds;
|
||||
}
|
||||
|
@@ -47,7 +47,7 @@ public:
|
||||
|
||||
uint16_t Map(int16_t x, int16_t y) const
|
||||
{
|
||||
if (x >= _width)
|
||||
if (x >= static_cast<int16_t>(_width))
|
||||
{
|
||||
x = _width - 1;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
{
|
||||
x = 0;
|
||||
}
|
||||
if (y >= _height)
|
||||
if (y >= static_cast<int16_t>(_height))
|
||||
{
|
||||
y = _height - 1;
|
||||
}
|
||||
|
@@ -26,6 +26,22 @@ License along with NeoPixel. If not, see
|
||||
|
||||
#pragma once
|
||||
|
||||
// some platforms do not come with STL or properly defined one, specifically functional
|
||||
// if you see...
|
||||
// undefined reference to `std::__throw_bad_function_call()'
|
||||
// ...then you can either add the platform symbol to the list so NEOPIXEBUS_NO_STL gets defined or
|
||||
// go to boards.txt and enable c++ by adding (teensy31.build.flags.libs=-lstdc++) and set to "smallest code" option in Arduino
|
||||
//
|
||||
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_MEGAAVR) || defined(STM32L432xx) || defined(STM32L476xx) || defined(ARDUINO_ARCH_SAM)
|
||||
#define NEOPIXEBUS_NO_STL 1
|
||||
#endif
|
||||
|
||||
// some platforms do not define this standard progmem type for some reason
|
||||
//
|
||||
#ifndef PGM_VOID_P
|
||||
#define PGM_VOID_P const void *
|
||||
#endif
|
||||
|
||||
#ifndef countof
|
||||
#define countof(array) (sizeof(array)/sizeof(array[0]))
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user