Release 2016.8.2 / Update 2017.1.1

AR-FOCUS tuning

ArduinoSometimes you’d better to customize values in sketch. I collected changeable values on the top of the sketch. So, try the difference in defines.

Input / Output pins

These are defined for input or output pins. It’s well known way and able to change pins, if you want to. But you should care about pins for encoder and LED. LED is need to be ‘analogWrite’ pin, and Encoder pin is need to be ‘interrupted’ pin.

//------------------------- pins defines ---------------------

#define VOL     A0
#define ENC_A   2
#define ENC_B   3
#define ALT_SW  7
#define AUTO_SW 13
#define LED_R   5
#define LED_G   6
#define LED_B   11

Momentary duration

You can adjust duration for pushing switches. “Gauging methods” which I thought it by myself.
Response for push are changed freely by “PUSH_SHORT” or “PUSH_LONG” define.

#define PUSH_SHORT    700
#define PUSH_LONG     45000

“PUSH_SHORT” is for a short time push. “PUSH_LONG” is for a long time push. These values are not time duration. Increase or decrease the values by your sense.

Switch logic

You can change logic of pullup or pulldown by these define.

#define ALT_LGC       1
#define AUTO_LGC      0

Set for your situation.

Variable resistor range

I used unique way for variable resistor in ‘AR-FOCUS’. Instead, it can’t get full bit value. And there are individual differences in this value. Adjust it for correct response.
Check values on “Ready?” screen display. This is direct value of variable resistor.
So, check its maximum vaule, and set it to ‘VOL_VAL’.

#define VOL_VAL       1004         // VR max value

Motor speed

I designed to skip ‘AUTO MOVE’ when set time is shorter than max motor speed. Change value on ‘MOTOR_SPD’. For example, my motor rotates 60 degrees in 230 milliseconds.

#define MOTOR_SPD     230/60       // motor speed millis seconds per 1 degree

Reducing jitter

Sometimes or in some motors, they makes noise even if you don’t move them. ‘JITTER_DEC’ might reduce the noises. Set it ‘true’.

#define JITTER_DEC 0        // detach servo PWM each 1.5sec idle

This function executes ‘detach’ when you don’t control AR-FOCUS for a while. But this function is disabled by default for thrift of sketch size. And I haven’t check about this function strictly yet. So it might goes wrong.

Servo microseconds

In servo library, there are min / max values. Min value is 544 by default. And max value is 2400. You can change the values in sketch.

//-- motor arguments --
short srv_lmt[2] = {544, 2400};

Also I designed a function for adjusting the values. Set ‘SRV_CAB’ to ‘true’.

#define SRV_CAB    0        // activate calibration servo mode

But also this function is disabled by default for thrift of sketch size. I recommend you to initialize after activate this function.

Frame rate for screen

You can change frame rate of OLED screen. Maybe response of control deponds on this refresh rate. Change of frame rate improves it, maybe. But also you have to recognize that screen display becomes slow.

#define FRATE         35           // OLED refresh frame rate