Skip to content

Instantly share code, notes, and snippets.

@leres
leres / patch-SevSeg.cpp
Created February 12, 2017 04:56
Arduino SevSeg patch
--- SevSeg.cpp.orig 2017-02-12 04:50:12 UTC
+++ SevSeg.cpp
@@ -284,6 +284,7 @@ void SevSeg::findDigits(long numToShow,
numToShow -= digits[digitNum] * factor;
}
+#ifndef ZERO_PAD
// Find unnnecessary leading zeros and set them to BLANK
for (digitNum = 0 ; digitNum < (numDigits - 1 - decPlaces) ; digitNum++){
if (digits[digitNum] == 0) {
@leres
leres / patch-SevSeg.h
Created February 12, 2017 04:47
Arduino SevSeg patch
--- SevSeg.h.orig 2016-09-18 00:30:22 UTC
+++ SevSeg.h
@@ -23,8 +23,12 @@
// If you use current-limiting resistors on your segment pins instead of the
// digit pins, then change the '0' in the line below to a '1'
+#ifndef RESISTORS_ON_SEGMENTS
#define RESISTORS_ON_SEGMENTS 0
+#endif
+#ifndef MAXNUMDIGITS
@leres
leres / patch-src_nsca.c
Created January 28, 2017 21:35
nsca ECONNABORTED patch
--- src/nsca.c.orig 2016-03-03 06:37:06 UTC
+++ src/nsca.c
@@ -901,7 +901,7 @@ static void accept_connection(int sock,
return;
/* try and handle temporary errors */
- if(errno==EWOULDBLOCK || errno==EINTR || errno==ECHILD){
+ if(errno==EWOULDBLOCK || errno==EINTR || errno==ECHILD || errno==ECONNABORTED){
if(mode==MULTI_PROCESS_DAEMON)
sleep(1);
@leres
leres / extrapatch-hardware-arduino-cores-arduino-WInterrupts.c
Last active December 10, 2015 07:19
arduino-1.0.3 patch: extrapatch-hardware-arduino-cores-arduino-WInterrupts.c
--- hardware/arduino/cores/arduino/WInterrupts.c.orig 2012-12-28 10:24:03.000000000 -0800
+++ hardware/arduino/cores/arduino/WInterrupts.c 2012-12-28 10:24:49.000000000 -0800
@@ -216,6 +216,21 @@
#warning detachInterrupt may need some more work for this cpu (case 1)
#endif
break;
+
+#if defined(INT2)
+ case 2:
+ #if defined(EIMSK)
@leres
leres / patch-hardware-arduino-cores-arduino-HardwareSerial.cpp
Created November 19, 2012 01:19
arduino-1.0.2 patch: arduino-1.0.2/hardware/arduino/cores/arduino/HardwareSerial.cpp
--- hardware/arduino/cores/arduino/HardwareSerial.cpp.orig 2012-07-28 21:20:49.000000000 -0700
+++ hardware/arduino/cores/arduino/HardwareSerial.cpp 2012-07-28 21:24:52.000000000 -0700
@@ -129,8 +129,6 @@
unsigned char c = UDR1;
store_char(c, &rx_buffer1);
}
-#elif defined(SIG_USART1_RECV)
- #error SIG_USART1_RECV
#endif
@leres
leres / patch-hardware-arduino-bootloaders-atmega8-ATmegaBOOT.c
Created November 19, 2012 00:59
arduino-1.0.2 patch: arduino-1.0.2/hardware/arduino/bootloaders/atmega8/ATmegaBOOT.c
--- hardware/arduino/bootloaders/atmega8/ATmegaBOOT.c.orig 2011-03-21 15:17:03.000000000 +0800
+++ hardware/arduino/bootloaders/atmega8/ATmegaBOOT.c 2011-03-21 15:17:23.000000000 +0800
@@ -36,7 +36,7 @@
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/interrupt.h>
-#include <avr/delay.h>
+#include <util/delay.h>
//#define F_CPU 16000000