From 8fd935fa941ba3844818a3b739de26cdbe5892e4 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sun, 26 Jul 2015 19:40:45 +0200 Subject: firmware: Fix D+ noise sensitivity issue --- firmware/main.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/firmware/main.c b/firmware/main.c index fdf22e4..80b5d3a 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -1,7 +1,7 @@ /* - * Project: Micronucleus - v2.0 + * Project: Micronucleus - v2.1 * - * Micronucleus V2.0 (c) 2014 Tim Bo"scke - cpldcpu@gmail.com + * Micronucleus V2.1 (c) 2015 Tim Bo"scke - cpldcpu@gmail.com * (c) 2014 Shay Green * Original Micronucleus (c) 2012 Jenna Fox * @@ -12,7 +12,7 @@ */ #define MICRONUCLEUS_VERSION_MAJOR 2 -#define MICRONUCLEUS_VERSION_MINOR 0 +#define MICRONUCLEUS_VERSION_MINOR 1 #include #include @@ -232,7 +232,7 @@ int main(void) { uint8_t osccal_tmp; bootLoaderInit(); - + /* save default OSCCAL calibration */ #if OSCCAL_RESTORE_DEFAULT osccal_default = OSCCAL; @@ -266,10 +266,10 @@ int main(void) { // adjust fastctr for 5ms timeout uint16_t fastctr=(uint16_t)(F_CPU/(1000.0f*15.0f/5.0f)); - uint8_t resetctr=20; + uint8_t resetctr=100; do { - if ((USBIN & USBMASK) !=0) resetctr=20; + if ((USBIN & USBMASK) !=0) resetctr=100; if (!--resetctr) { // reset encountered usbNewDeviceAddr = 0; // bits from the reset handling of usbpoll() @@ -280,7 +280,8 @@ int main(void) { } if (USB_INTR_PENDING & (1<