Skip to content

Commit afea18e

Browse files
authored
Merge pull request bremme#40 from berendkleinhaneveld/master
Fix compiler warnings
2 parents 5af549e + 23d77cd commit afea18e

File tree

7 files changed

+24
-15
lines changed

7 files changed

+24
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ If you use any of these super classes, you will also get all the basic, advanced
8282
* `snake()` Classic snake demo
8383
* `nightrider()` Nightrider Kit demo
8484
* `bombTimer()` Count down a (bomb) timer
85-
* `bouchingBall()` Bounching ball demo
85+
* `bouncingBall()` Bouncing ball demo
8686

8787
For more extended information on what arguments all above functions accept and return see the header files of the classes (SevenSegmentTM1637.h, SevenSegmentExtended.h and SevenSegmentFun.h).
8888

examples/FunPrintAll/FunPrintAll.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ void loop() {
4545
introDuceNextDemo("AUDIO VOLUME DEMO");
4646
audioVolume();
4747

48-
// bounchin ball
49-
introDuceNextDemo("BOUNCHING BALL DEMO");
48+
// bouncing ball
49+
introDuceNextDemo("BOUNCING BALL DEMO");
5050
unsigned int numMoves = 100; unsigned int timeDelay = 100;
51-
display.bouchingBall(numMoves, timeDelay);
51+
display.bouncingBall(numMoves, timeDelay);
5252

5353
// scrolling text
5454
introDuceNextDemo("SCROLLING TEXT DEMO");

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version=1.0.0
33
author=Bram Harmsen <bramharmsen@gmail.com>
44
maintainer=Bram Harmsen <bramharmsen@gmail.com>
55
sentence=Library for using a 4 digit seven segment display with TM1636 or TM1637 driver IC
6-
paragraph=Extensive library for controlling a 4 digit seven segment display. This library inherent the Print class and uses the LCDAPI 1.0. For example you can use all normal Print methods like: print() and println(). From the LCDAPI among others begin(), clear(), home(), setCursor() and setBacklight() are implementend. On top of these regular functionality a segerate fun class which adds more features can be used. For example a bombtimer(), nightrider() and bounchingBall() method can be used when using the fun class.
6+
paragraph=Extensive library for controlling a 4 digit seven segment display. This library inherent the Print class and uses the LCDAPI 1.0. For example you can use all normal Print methods like: print() and println(). From the LCDAPI among others begin(), clear(), home(), setCursor() and setBacklight() are implementend. On top of these regular functionality a segerate fun class which adds more features can be used. For example a bombtimer(), nightrider() and bouncingBall() method can be used when using the fun class.
77
category=Display
88
url=https://github.com/bremme/arduino-tm1637
99
architectures=avr

src/SevenSegmentFun.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void SevenSegmentFun::bombTimer(uint8_t hours, uint8_t min, uint16_t speed, cha
164164
blink();
165165
};
166166

167-
void SevenSegmentFun::bouchingBall(uint16_t moves, uint16_t d, bool runForever) {
167+
void SevenSegmentFun::bouncingBall(uint16_t moves, uint16_t d, bool runForever) {
168168

169169
int8_t wallRight = TM1637_MAX_COLOM - 1;
170170
int8_t wallBottom = TM1637_MAX_LINES;
@@ -174,7 +174,7 @@ void SevenSegmentFun::bouchingBall(uint16_t moves, uint16_t d, bool runForever)
174174
int8_t newX; int8_t newY;
175175
// default speed is 1 x right and 2 y down
176176
int8_t vx = 1; int8_t vy = 1;
177-
bool flipVx; bool flipVy;
177+
bool flipVx = false; bool flipVy = false;
178178

179179
// print initial state
180180
printBall(x, y);

src/SevenSegmentFun.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// COMPILE TIME USER CONFIG ////////////////////////////////////////////////////
1414
#define TM1637_SNAKE_DEFAULT_DELAY 50 // Snake step delay ms
15-
#define TM1637_BOUNCH_BALL_DEFAULT_DELAY 100 // Bounching ball delay ms
15+
#define TM1637_BOUNCING_BALL_DEFAULT_DELAY 100 // Bouncing ball delay ms
1616
#define TM1637_NIGHTRIDER_DEFAULT_DELAY 200 // Nightrider delay ms
1717
//
1818
// A
@@ -53,7 +53,7 @@ class SevenSegmentFun : public SevenSegmentExtended {
5353
void nightrider(uint8_t repeats = 10, uint16_t d = TM1637_NIGHTRIDER_DEFAULT_DELAY, uint8_t symbol = TM1637_CHAR_VERT_LEVEL);
5454
void bombTimer(uint8_t hours, uint8_t min, uint16_t speed = 60);
5555
void bombTimer(uint8_t hours, uint8_t min, uint16_t speed, char* str);
56-
void bouchingBall(uint16_t moves, uint16_t d, bool runForever = false);
56+
void bouncingBall(uint16_t moves, uint16_t d, bool runForever = false);
5757

5858
void printBall(const int8_t x, const int8_t y);
5959
void print4Bit(const uint8_t x, const uint8_t y, uint8_t symbol);

src/SevenSegmentTM1637.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,21 @@ SevenSegmentTM1637::SevenSegmentTM1637(uint8_t pinClk, uint8_t pinDIO) :
134134
size_t SevenSegmentTM1637::write(uint8_t byte) {
135135
TM1637_DEBUG_PRINT(F("write byte:\t")); TM1637_DEBUG_PRINTLN(byte);
136136

137+
size_t n = 0;
137138
if ( _cursorPos == _numCols ) {
138139
shiftLeft(_rawBuffer, _numCols);
139140
_rawBuffer[_cursorPos] = encode( (char)byte );
140141
printRaw( _rawBuffer, _numCols, 0);
142+
++n;
141143
};
142144

143145
if (_cursorPos < _numCols) {
144146
_rawBuffer[_cursorPos] = encode( (char)byte );
145147
printRaw( _rawBuffer, _cursorPos+1, 0);
146148
setCursor(1, _cursorPos + 1);
147-
};
148-
149+
++n;
150+
}
151+
return n;
149152
}
150153

151154
// null terminated char array
@@ -164,6 +167,7 @@ size_t SevenSegmentTM1637::write(const char* str) {
164167
break;
165168
}
166169
}
170+
return i;
167171
};
168172

169173
// byte array with length
@@ -177,6 +181,7 @@ size_t SevenSegmentTM1637::write(const uint8_t* buffer, size_t size) {
177181
size_t length = encode(encodedBytes, buffer, size);
178182
TM1637_DEBUG_PRINT(F(" ")); TM1637_DEBUG_PRINTLN(encodedBytes[0], BIN);
179183
printRaw(encodedBytes,length, _cursorPos);
184+
return length;
180185
};
181186

182187
// Liquid cristal API
@@ -243,11 +248,15 @@ void SevenSegmentTM1637::setBacklight(uint8_t value) {
243248
cmd |= TM1637_SET_DISPLAY_ON | TM1637_SET_DISPLAY_14;
244249
break;
245250
};
251+
#if TM1637_DEBUG
246252
bool ack = command(cmd);
247253
TM1637_DEBUG_PRINT(F("SET_DISPLAY:\t")); TM1637_DEBUG_PRINTLN((
248254
cmd
249255
), BIN);
250256
TM1637_DEBUG_PRINT(F("Acknowledged:\t")); TM1637_DEBUG_PRINTLN(ack);
257+
#else
258+
command(cmd);
259+
#endif
251260
};
252261

253262
void SevenSegmentTM1637::setContrast(uint8_t value) {
@@ -493,7 +502,7 @@ void SevenSegmentTM1637::comStop(uint8_t pinClk, uint8_t pinDIO) {
493502
}
494503

495504
bool SevenSegmentTM1637::comAck(void) const {
496-
comAck(_pinClk, _pinDIO);
505+
return comAck(_pinClk, _pinDIO);
497506
};
498507

499508
bool SevenSegmentTM1637::comAck(uint8_t pinClk, uint8_t pinDIO) {

src/SevenSegmentTM1637.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class SevenSegmentTM1637 : public Print {
104104

105105
public:
106106
// LIQUID CRISTAL API ///////////////////////////////////////////////////////
107-
/* See http://playground.arduino.cc/Code/LCDAPI for more details.
107+
// See http://playground.arduino.cc/Code/LCDAPI for more details.
108108

109109
/* Constructor
110110
@param [in] pinClk clock pin (any digital pin)
@@ -121,7 +121,7 @@ class SevenSegmentTM1637 : public Print {
121121
/* Implemented for compatibility, see begin() above */
122122
void begin(uint8_t cols = TM1637_MAX_COLOM, uint8_t rows = TM1637_MAX_LINES);
123123
// Print class inheritance ///////////////////////////////////////////////////
124-
/* See https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Print.h for more details
124+
// See https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Print.h for more details
125125
/* This library inherent the Print class, this means that all regular print function can be used. For example:
126126
* printing a number: print(78)
127127
* printint a number in BIN, OCT, HEX..: print(78, BIN)
@@ -235,7 +235,7 @@ class SevenSegmentTM1637 : public Print {
235235
*
236236
* For example to print an H, you would set bits BCEFG, this gives B01110110 in binary or 118 in decimal or 0x76 in HEX.
237237
* Bit 7 (X) only applies to the second digit and sets the colon
238-
*
238+
*/
239239
/* Print raw (binary encodes) bytes to the display
240240
@param [in] rawBytes Array of raw bytes
241241
@param [in] length optional: length to print to display

0 commit comments

Comments
 (0)