Quellcode durchsuchen

Added option to increase the FAN PWM frequency.

Erik van der Zalm vor 13 Jahren
Ursprung
Commit
1874cb71a6
4 geänderte Dateien mit 82 neuen und 1 gelöschten Zeilen
  1. 4
    1
      Marlin/Configuration.h
  2. 4
    0
      Marlin/Marlin.h
  3. 71
    0
      Marlin/Marlin.pde
  4. 3
    0
      Marlin/temperature.cpp

+ 4
- 1
Marlin/Configuration.h Datei anzeigen

8
 //User specified version info of THIS file to display in [Pronterface, etc] terminal window during startup.
8
 //User specified version info of THIS file to display in [Pronterface, etc] terminal window during startup.
9
 //Implementation of an idea by Prof Braino to inform user that any changes made
9
 //Implementation of an idea by Prof Braino to inform user that any changes made
10
 //to THIS file by the user have been successfully uploaded into firmware.
10
 //to THIS file by the user have been successfully uploaded into firmware.
11
-#define STRING_VERSION_CONFIG_H "2012-02-25" //Personal revision number for changes to THIS file.
11
+#define STRING_VERSION_CONFIG_H "2012-05-02" //Personal revision number for changes to THIS file.
12
 #define STRING_CONFIG_H_AUTHOR "erik" //Who made the changes.
12
 #define STRING_CONFIG_H_AUTHOR "erik" //Who made the changes.
13
 
13
 
14
 // This determines the communication speed of the printer
14
 // This determines the communication speed of the printer
230
   #endif
230
   #endif
231
 #endif
231
 #endif
232
 
232
 
233
+// Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino
234
+#define FAST_PWM_FAN
235
+
233
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
236
 // M240  Triggers a camera by emulating a Canon RC-1 Remote
234
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
237
 // Data from: http://www.doc-diy.net/photo/rc-1_hacked/
235
 // #define PHOTOGRAPH_PIN     23
238
 // #define PHOTOGRAPH_PIN     23

+ 4
- 0
Marlin/Marlin.h Datei anzeigen

170
 void enquecommand(const char *cmd); //put an ascii command at the end of the current buffer.
170
 void enquecommand(const char *cmd); //put an ascii command at the end of the current buffer.
171
 void prepare_arc_move(char isclockwise);
171
 void prepare_arc_move(char isclockwise);
172
 
172
 
173
+#ifdef FAST_PWM_FAN
174
+void setPwmFrequency(uint8_t pin, int val);
175
+#endif
176
+
173
 #ifndef CRITICAL_SECTION_START
177
 #ifndef CRITICAL_SECTION_START
174
   #define CRITICAL_SECTION_START  unsigned char _sreg = SREG; cli();
178
   #define CRITICAL_SECTION_START  unsigned char _sreg = SREG; cli();
175
   #define CRITICAL_SECTION_END    SREG = _sreg;
179
   #define CRITICAL_SECTION_END    SREG = _sreg;

+ 71
- 0
Marlin/Marlin.pde Datei anzeigen

36
 #include "watchdog.h"
36
 #include "watchdog.h"
37
 #include "EEPROMwrite.h"
37
 #include "EEPROMwrite.h"
38
 #include "language.h"
38
 #include "language.h"
39
+#include "pins_arduino.h"
39
 
40
 
40
 #define VERSION_STRING  "1.0.0 RC2"
41
 #define VERSION_STRING  "1.0.0 RC2"
41
 
42
 
1512
 
1513
 
1513
 bool IsStopped() { return Stopped; };
1514
 bool IsStopped() { return Stopped; };
1514
 
1515
 
1516
+#ifdef FAST_PWM_FAN
1517
+void setPwmFrequency(uint8_t pin, int val)
1518
+{
1519
+  val &= 0x07;
1520
+  switch(digitalPinToTimer(pin))
1521
+  {
1522
+ 
1523
+    #if defined(TCCR0A)
1524
+    case TIMER0A:
1525
+    case TIMER0B:
1526
+         TCCR0B &= ~(CS00 | CS01 | CS02);
1527
+         TCCR0B |= val;
1528
+         break;
1529
+    #endif
1530
+
1531
+    #if defined(TCCR1A)
1532
+    case TIMER1A:
1533
+    case TIMER1B:
1534
+         TCCR1B &= ~(CS10 | CS11 | CS12);
1535
+         TCCR1B |= val;
1536
+         break;
1537
+    #endif
1538
+
1539
+    #if defined(TCCR2)
1540
+    case TIMER2:
1541
+    case TIMER2:
1542
+         TCCR2 &= ~(CS10 | CS11 | CS12);
1543
+         TCCR2 |= val;
1544
+         break;
1545
+    #endif
1546
+
1547
+    #if defined(TCCR2A)
1548
+    case TIMER2A:
1549
+    case TIMER2B:
1550
+         TCCR2B &= ~(CS20 | CS21 | CS22);
1551
+         TCCR2B |= val;
1552
+         break;
1553
+    #endif
1554
+
1555
+    #if defined(TCCR3A)
1556
+    case TIMER3A:
1557
+    case TIMER3B:
1558
+    case TIMER3C:
1559
+         TCCR3B &= ~(CS30 | CS31 | CS32);
1560
+         TCCR3B |= val;
1561
+         break;
1562
+    #endif
1563
+
1564
+    #if defined(TCCR4A) 
1565
+    case TIMER4A:
1566
+    case TIMER4B:
1567
+    case TIMER4C:
1568
+         TCCR4B &= ~(CS40 | CS41 | CS42);
1569
+         TCCR4B |= val;
1570
+         break;
1571
+   #endif
1572
+
1573
+    #if defined(TCCR5A) 
1574
+    case TIMER5A:
1575
+    case TIMER5B:
1576
+    case TIMER5C:
1577
+         TCCR5B &= ~(CS50 | CS51 | CS52);
1578
+         TCCR5B |= val;
1579
+         break;
1580
+   #endif
1581
+
1582
+  }
1583
+}
1584
+#endif
1585
+
1515
 
1586
 

+ 3
- 0
Marlin/temperature.cpp Datei anzeigen

559
   #endif  
559
   #endif  
560
   #if (FAN_PIN > -1) 
560
   #if (FAN_PIN > -1) 
561
     SET_OUTPUT(FAN_PIN);
561
     SET_OUTPUT(FAN_PIN);
562
+    #ifdef FAST_PWM_FAN
563
+    setPwmFrequency(FAN_PIN, 1); // No prescaling. Pwm frequency = F_CPU/256/8
564
+    #endif
562
   #endif  
565
   #endif  
563
 
566
 
564
   #ifdef HEATER_0_USES_MAX6675
567
   #ifdef HEATER_0_USES_MAX6675

Laden…
Abbrechen
Speichern