Skip to content

Commit 02c5ee9

Browse files
committed
remove debug, extra lines spaces =
Removed the #ifdef print code. Also removed a couple of extra blank lines that were added. Found a couple places where I cut and pasted in some variable definitions that did not have spaces around =
1 parent 604d84f commit 02c5ee9

File tree

1 file changed

+3
-29
lines changed

1 file changed

+3
-29
lines changed

src/renesas/Servo.cpp

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,12 @@
2828
#include "math.h"
2929
#include "FspTimer.h"
3030

31-
// uncomment to print servo Debug information
32-
//#define SERVO_PRINT_DEBUG_INFO
33-
3431
#define SERVO_MAX_SERVOS (_Nbr_16timers * SERVOS_PER_TIMER)
3532
#define SERVO_INVALID_INDEX (255)
3633
// Lower the timer ticks for finer resolution.
3734
#define SERVO_TIMER_TICK_US (100)
3835
#define SERVO_US_PER_CYCLE (20000)
3936
#define SERVO_IO_PORT_ADDR(pn) &((R_PORT0 + ((uint32_t) (R_PORT1 - R_PORT0) * (pn)))->PCNTR3)
40-
4137
#define MIN_CYCLE_OFF_US 50
4238

4339
// Internal Servo sturct to keep track of RA configuration.
@@ -76,21 +72,13 @@ static uint32_t usToticks(uint32_t time_us) {
7672
}
7773

7874

79-
80-
8175
static int servo_timer_config(uint32_t period_us)
8276
{
8377
static bool configured = false;
8478
if (configured == false) {
8579
// Configure and enable the servo timer, for full 20ms
8680
uint8_t type = 0;
8781
int8_t channel = FspTimer::get_available_timer(type);
88-
#ifdef SERVO_PRINT_DEBUG_INFO
89-
Serial.print("\nservo_timer_config: type:");
90-
Serial.print(type, DEC);
91-
Serial.print(" Channel: ");
92-
Serial.println(channel, DEC);
93-
#endif
9482
if (channel != -1) {
9583
// lets initially configure the servo to 50ms
9684
servo_timer.begin(TIMER_MODE_PERIODIC, type, channel,
@@ -110,26 +98,13 @@ static int servo_timer_config(uint32_t period_us)
11098
// Now lets see what the period;
11199
servo_ticks_per_cycle = servo_timer.get_period_raw();
112100
min_servo_cycle_low = usToticks(MIN_CYCLE_OFF_US);
113-
#ifdef SERVO_PRINT_DEBUG_INFO
114-
Serial.print("Period:");
115-
Serial.println(servo_ticks_per_cycle, DEC);
116-
uint32_t ticks_544 = usToticks(544);
117-
uint32_t ticks_2400 = usToticks(2400);
118-
Serial.print("Min 544(ticks): ");
119-
Serial.print(ticks_544);
120-
Serial.print(" Max 2400: ");
121-
Serial.print(ticks_2400);
122-
Serial.print(" per degree: ");
123-
Serial.println((float)(ticks_2400 - ticks_544) / 180.0f, 2);
124-
#endif
125101

126102
configured = true;
127103
}
128104
}
129105
return configured ? 0 : -1;
130106
}
131107

132-
133108
static int servo_timer_start()
134109
{
135110
// Start the timer if it's not started
@@ -165,9 +140,9 @@ inline static void updateClockPeriod(uint32_t period) {
165140
void servo_timer_callback(timer_callback_args_t *args)
166141
{
167142
(void)args; // remove warning
168-
static uint8_t channel=SERVO_MAX_SERVOS;
169-
static uint8_t channel_pin_set_high=0xff;
170-
static uint32_t ticks_accum=0;
143+
static uint8_t channel = SERVO_MAX_SERVOS;
144+
static uint8_t channel_pin_set_high = 0xff;
145+
static uint32_t ticks_accum = 0;
171146

172147
// See if we need to set a servo back low
173148
if (channel_pin_set_high != 0xff) {
@@ -254,7 +229,6 @@ uint8_t Servo::attach(int pin, int min, int max)
254229
if (servo_timer_start() != 0) {
255230
return 0;
256231
}
257-
258232
return 1;
259233
}
260234

0 commit comments

Comments
 (0)