Skip to content

Commit 936a9fb

Browse files
committed
Fixed the build dependency on HotStepper
1 parent 48c9cd2 commit 936a9fb

File tree

4 files changed

+13
-27
lines changed

4 files changed

+13
-27
lines changed

HotStepper.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -191,5 +191,16 @@ void HotStepper::triggerTop(){
191191
}
192192
}
193193

194+
#ifdef HOTSTEPPER_TIMER1
195+
ISR(TIMER1_COMPA_vect)
196+
{
197+
HotStepper::triggerTop();
198+
}
199+
#endif
194200

195-
201+
#ifdef HOTSTEPPER_TIMER2
202+
ISR(TIMER2_COMPA_vect)
203+
{
204+
HotStepper::triggerTop();
205+
}
206+
#endif

HotStepper.h

+1-21
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
#define TIMER1INT 1
1212
#define TIMER2INT 2
1313

14-
#ifndef HOTSTEPPER_TIMER1
15-
#define HOTSTEPPER_TIMER2
16-
#endif
17-
14+
#define HOTSTEPPER_TIMER1
1815

1916
class HotStepper {
2017
public:
@@ -47,21 +44,4 @@ class HotStepper {
4744
byte unpad(byte, byte);
4845
};
4946

50-
#ifndef FROM_LIB
51-
#ifdef HOTSTEPPER_TIMER1
52-
ISR(TIMER1_COMPA_vect)
53-
{
54-
HotStepper::triggerTop();
55-
}
56-
#endif
57-
58-
#ifdef HOTSTEPPER_TIMER2
59-
ISR(TIMER2_COMPA_vect)
60-
{
61-
HotStepper::triggerTop();
62-
}
6347
#endif
64-
#endif
65-
66-
#endif
67-

Mirobot.h

-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
#ifndef Mirobot_h
22
#define Mirobot_h
33

4-
#define FROM_LIB
54
#include "Arduino.h"
65
#include "HotStepper.h"
76
#include "CmdProcessor.h"
8-
#include "HotStepper.h"
97
#include <EEPROM.h>
108

119
#define STEPS_PER_TURN 2048.0

examples/firmware/firmware.ino

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#define HOTSTEPPER_TIMER1
2-
#include <stdlib.h>
3-
#include <HotStepper.h>
41
#include <Mirobot.h>
52
#include <EEPROM.h>
63

0 commit comments

Comments
 (0)