Beruflich Dokumente
Kultur Dokumente
Repetier-Firmware Documentation
Installation
Arduino-IDE
We use cookies. If you continue to use this site we will assume that you agree with it. You can delete our cookies. How this works, is explained in our privacy policy. OK Reject
First you need to get and install the development software. Don’t worry, it is easy and you won’t need special programming skills.
Get your version of the Arduino IDE from https://www.arduino.cc/en/Main/Software. The software is available for WIndows,
Linux and Mac. Follow the instruction on the Arduino site. You will need Arduino 1.8.5 or higher.
The IDE contains only the o cially supported board driver. If your board is not included, you need to install the missing device
les. Not included are les for Gen 6, Sanguinololu, Gen7, Teensylu and Printrboard.
The next step is driver installation. The boards all use a serial protocol. Which is ne if your printer had a serial port. The
designer of the Arduino knew this problem and have added a usb->serial converter on board. That is the reason, you need to
install the usb driver used on the board. Some board/OS combinations don‘t need a special driver. If you are a Windows user – I
didn‘t mean you.
To understand the IDE, you should now download the latest version of Repetier-Firmware.
It is not necessary to clone the repository. All you need is to download the contents as a ZIP le. Download the le and unpack
the contents. Start the IDE and go to File->Open and select the le „Repetier.ino“ in the repetier subdirectory.
Before you can compile and upload the rmware, you need to select the board and port. You do this in the Tools menu. Start
with your board. The port can only be selected, if your printer is online and connected.
Congratulations! You just compiled and uploaded your rst rmware. You can start your host software and connect to the board
with the set baud rate. Don‘t try to print now. You haven‘t set up everything needed. But you can already ask rmware name with
„M115“ or move the printer head a bit (no long distance before you set up the correct steps per mm for your axis).
Common errors
If the MOTHERBOARD setting does not match your board settings, you will get a corresponding error message.
If your host is still connected to the board, you can not update a new rmware.
Sometimes the uploader fails to reset the board to start the bootloader. If you see the rmware is compiled and the
led doesn‘t start ashing within 5 seconds, press the reset button on the board. Often this helps.
Sometimes you will get a fsync error message from the uploader. Unplug the printer and reconnect it. If it doesn‘t go
away reboot your computer.
When you open the „Con guration.h“ le, you see a lot of comments and some values to change. These con gurations are all
done with preprocessor commands.
#define EEPROM_MODE 1
A value of 0 would disable the EEPROM usage. Any other value from 1 to 255 enables it and determents if the values from the
con guration le are copied to the EEPROM at the rst start, or if the old values are kept. The trick is quite simple. The rst byte
in EEPROM is compared with the EEPROM_MODE value. If it has a di erent value, the values in your „Con guration.h“ are copied
to EEPROM and byte 0 is set to the mode. After the next startup, the rmware sees the value is the same and will use the values
already stored in EEPROM,
A correct initialization is important for a good function. If you have used an other software, that also writes to the EEPROM, your
data gets corrupted and you should make sure, the values are reinitialized. From version 0.80 onwards the rmware stores a
checksum, so most corruptions are detected automatically.
If you have followed the rst installation example, you have already written values to your EEPROM. It is a good idea to change
the EEPROM_MODE to 2 now, so you overwrite it with the con guration you will now de ne.
From version 0.80 onwards you can overwrite the EEPROM values with the values from Con guration.h using M502.
For a manual change send “M205” to your board and you will get a list with all parameters with position, type and value. The
output will look like this:
The rst value is the data type (0=byte, 1=16 bit int,2=32 bit int,3 = oat). The second parameter is the position in EEPROM, the
value is stored. The third parameter is the current value. The rest of the line is a short description of the parameter.
Type and position must match the values returned by M205, otherwise you will overwrite some other data with undeterminable
results.
Steps per mm
Your printer uses stepper motors to move the extruder and for the extrusion it self. Depending on your con guration, you need
x steps to move or extrude 1 mm. That is the value you need to enter. With some math you can get the values very easy. Do the
example computations with your hardware settings and you are done.
StepsPerTurn = 200 // Most stepper motors have 1.8 Degree per step (some 0.9)
BeltDistance = 5mm // Distance between repeating grooves. T5 belt = 5mm
GroovesInPulley = 8 // 8-10 are common values
Substepping = 16 // 16 Substeps for a full step needed
StepsPerMM = StepsPerTurn*Substepping/(BeltDistance**GroovesInPulley)
= 200*16/(5*8) = 80
Temperature measurement
Before you can control the temperature, you need to measure it. The most common method used in the RepRap community is
to use a NTC thermistor. With the help of of the circuit shown below, the AVR can measure a voltage, which depends on the used
resistors and the temperature at the thermistor.
So how does it work? For a long and good description read nopheads excellent article
(http://hydraraptor.blogspot.de/2007/10/measuring-temperature-easy-way.html). The short version is, the NTC changes its
resistance. Using a NTC means, with increasing temperature the resistance drops. This causes the measured voltage to change.
With the full circuit, we end with the formula:
RS = R * R1 / (R+R1)
After knowing how to convert a temperature into a voltage, how do we get this into the rmware? The current Arduino
generation uses AVR controller with a resolution of 10 bit. The voltage is converted into a number between 0 for ground and
1023 for VRef, which is normally 5V. The new XMega AVR controller have a resolution of 12 bit, resulting in values from 0 to 4095.
To be ready for the future, the rmware adds 4 readings for a temperature calculation, resulting in a range from 0 to 4092. From
this value, the rmware must compute the temperature at the thermistor. So far, so good. Unfortunately, the voltage-
temperature-curve is nonlinear and di ers for every thermistor type. Even di erent 100K thermistors have di erent curves. As a
solution, the rmware uses a lookup table from which it interpolates temperatures between given values.
#define USER_THERMISTORTABLE0 {\
{1*4,864*8},{21*4,300*8},{25*4,290*8},{29*4,280*8},{33*4,270*8},{39*4,260*8},{46*4,250*8},{54*4,240*8},{64*4,23
{90*4,210*8},{107*4,200*8},{128*4,190*8},{154*4,180*8},{184*4,170*8},{221*4,160*8},{265*4,150*8},{316*4,140*8},
{441*4,120*8},{513*4,110*8},{588*4,100*8},{734*4,80*8},{856*4,60*8},{938*4,40*8},{986*4,20*8},{1008*4,0*8},{101
For those with little C experience: The de ne must be in one line, which isn’t very readable. So to break it into di erent lines,
append a backslash at the end of the line, to indicate that the line continues in the following line.
This lookup table has 28 reference values. Make sure the correct number is set in you con guration. For this table, I set
#define NUM_TEMPS_USERTHERMISTOR0 28
The table here contains 28 pairs of {adc, temperature*8} with the adc reading in range 0-4093 and temperature values multiplied
with 8 as integer. The pairs must be ordered with increasing adc values!
What you see is the lookup table for an EPCOS G550 thermistor. The table consists of two columns. The rst is the voltage
reading and the second is the temperature. In the table, you see that the readings are multiplied with 4 and the temperatures
with 8. I’ve taken this format, because most rmwares use a reading range from 0-1023 and full integer values for temperatures.
Repetier-Firmware uses a higher resolution for input and temperature and these factors convert old tables you may have into
the needed value range for Repetier-Firmware. If you don’t have a matching table, you have to compute one.
Looking into the datasheet gives characteristic curve 8404 for this thermistor. A look into the table shows temperatures and a
factor RT/R25. Knowing R25 is 100K, we can compute the resistance for every temperature. Lets look at 100°C. We get a factor
0.063688, so R100 = 100000*0.063688 = 6368.8. In this example I take R1 not present and R2 = 4,7K. U100 =
4093*6368.8/(6368.8+4700) = 2355 = 4*588.76
Compute the values and enter them into one of the user de nable thermistor lookup tables in Con guration.h. The order
matters – start with the highest temperature. You can leave the rst value for safety.
Controlling temperature
Knowing the temperature, we can start controlling the heater. The rmware currently supports two methods.
Bang-Bang control
This is the method used for a heated bed and for the extruder, if you set heat manager to 0. The principle is very simple. If the
measured temperature is below the target temperature, the heater is set at full power. If the temperature rises above the target
temperature, the heater is turned o .
Pros: Simple Cons: Temperature oscillates around the target temperature. For the heated bed, this is no real problem. If you are
using PLA this is no big issue. With ABS you may want a more precise control.
PID control
For a better controlled temperature, the rmware uses a PID controller. This requires an output with PWM using a unused timer.
Currently only RAMP
RAMPS 1.0 doesn’t have a free timer for PID control. PID control is only implemented for extruder. For a better
overview, lets have a look at the parameter used:
/** \brief The maximum value, I-gain can contribute to the output.
A good value is slightly higher then the output needed for your temperature.
Values for starts:
130 => PLA for temperatures from 170-180°C
180 => ABS for temperatures around 240°C
The I state should converge to the exact heater output needed for the target temperature.
To prevent a long deviation from the target zone, this value limits the lower value.
A good start is 30 lower then the optimal value. You need to leave room for cooling.
Overridden if EEPROM activated.
*/
#define EXT0_PID_INTEGRAL_DRIVE_MIN 60
/** P-gain. Overridden if EEPROM activated. */
#define EXT0_PID_P 24
/** I-gain. Overridden if EEPROM activated.
*/
#define EXT0_PID_I 0.88
/** Dgain. Overridden if EEPROM activated.*/
#define EXT0_PID_D 80
// maximum time the heater is can be switched on. Max = 255. Overridden if EEPROM activated.
#define EXT0_PID_MAX 255
I know, quite a number of factors, but don’t worry. It’s not that complicated if you understand, what the parameter are used for.
The rst one you should look at is PID_MAX. It’s the maximum PWM setting for your output. Normally, the heating resistor is
selected, that a maximum value of 255 is allowed, meaning the full voltage (normally 12V) is send to the resistor. The lost energy
at the resistor is U2/R. If you increase your voltage above the designed voltage, you may blow it with full settings. Reduce it in this
case.
At the start, the controller behaves like the Bang-Bang controller, except that it uses PID_MAX instead of full power. Only if the
current temperature is in a range of +/-10°C from the target temperature the real PID control starts. For the output, three terms
P, I and D are computed and added to get the output value. The result is clipped to the range 0..PID_MAX
P-Term
The P-Term adds a value proportional to the temperature error.
P = (TTarget-TCurrent)*P_GAIN
The closer the target temperature is reached, the lower the term gets. It will always oscillate around a value some degrees below
the target temperature if left alone.
I-Term
The I-Term is the most important one. The I-Term tries to nd the perfect output for your temperature. It does this by
incrementing/decrementing the output slowly. The speed is de ned by the I_GAIN parameter. You can help a lot, if you limit the
range of possible values to a known range INTEGRAL_DRIVE_MIN .. INTEGRAL_DRIVE_MAX. The min value should be at least 0
and the max not exceed 255. If you don’t know what works for you, use these extreme values and watch the output with the
command M203 S0. When you that the temperature stabilizes, take the mean value and add/sub 20. If you like to change
temperatures, set the limits, so all possible ranges are enclosed with a safety factor.
If your I_GAIN is set to a good value, you will see that the oscillation gets smaller with time. Disturbances like di erent printing
speed or blowing at the nozzle may increase the error again.
D-Term
The D-Term is the damping factor. With a good damping factor, your oscillations will slow down much faster and you get a much
more stable system. Don’t by show using more then 100%. The default is already 500%.
Finding proper PID values is di cult for the unexperienced. To overcome this, the rmware has a autotune function to nd
good values. Disable the extruder and wait until it is more or less cold. Then start autotune with
M303 P0 S180
This assumes you want to find the PID values for your first extruder and your typical target temperature wil
SCALE_PID_TO_MAX
This option only tells, when and how to scale down to DRIVE_MAX. If set to 0, the addition of the PID-Terms is clamped to
0..DRIVE_MAX. If you set this to 1, the PID Term gets clamped to 0..255 and is then scaled to 0..DRIVE_MAX.
What’s the di erence? If you have DRIVE_MAX=255 there is no di erence. If you have found your perfect values for 12V and
DRIV_MAX=255 and now want’s to use 18V, you have to reduce DRIVE_MAX to DRIVE_MAX_OLD*(12^2/18^2)=113 to protected
your resistor. If you want to keep your found factors, set DRIVE_MAX to 133 and SCALE_PID_TO_MAX 1. If you leave it 0, the found
terms are to high and don’t work any more.
Jerk
Jerk is what makes your printer shake. It is a speed di erence between two moves, which can be reached without acceleration.
So why do you want jerk and what does it in uence? The rst thing it in uences is the starting speed. It is 50% of the allowed
jerk. So if you have a jerk of 20, the rst move will start with 10mm/s. The other thing jerk controls is the join speed for
consecutive segments. In the gure above you see two examples. The jerk is the di erence of the two speeds. Example 1 shows
a jerk, that is higher then allowed. In this case, the path planner will reduce the speed to match exactly the maximum allowed
speed. Example 2 has a lower directional change, so the jerk is within allowed limits and the planner allows a full speed move
through the edge. The jerk is set these two values:
MAX_JERK is for x/y axis moves and MAX_ZJERK for moves in Z direction.
You see, it is balance between your personal priorities. The only simple thing is z-jerk, which has nearly no in uence. It only
reduces the time for z-moves, but has no e ect on quality.
Path planning
Path planning makes your printer moves more smooth. Have a look at the above picture. It shows a print of three lines. Without
path planning, the printer needs to follow the blue path. For each segment it will accelerate to the commanded feed rate and
back to the maximum end speed allowed. The path planner looks for previous moves, which aren‘t executed now and tries to
remove the deceleration/acceleration between line joints, resulting in the much smoother red line. For each line joint, the
maximum allowed jerk is computed and speed is reduced if needed to reduce the jerk. In most cases this is still much faster then
the start/stop speed you would have otherwise. In circles you will most likely have no speed reduction at all. The only bad thing
about path planning is, that it needs computation time. For each new line segment the algorithm needs to update older entries.
For normal moves, this is no big deal and is very fast. Only if you have many very short moves, the update time becomes
dominant and the rmware has to slow down the print. The behavior is in uenced by the following con guration parameter:
Trajectory smoothing
The rmware uses the bresenham algorithm for the computations of the x, y, z and e axis. It takes the axis with the most steps
needed and moves over the steps of this axis. At these steps it looks if other axis need also a step. What happens is, that the
timing of the primary axis is perfect, while the dependent axises are only updated at the discrete points, not at the best time.
This gives a little jitter to the dependent axis. To reduce this e ect, the rmware can do half steps on the primary axis. The price
you pay is double computation cost for the stepper update computation. For safety, this behavior is only enabled, if the shortest
time between two full steps is larger then MAX_HALFSTEP_INTERVAL ticks (default1999). This allows smoothing with a frequency
of 8000 hertz. If you have 80steps/mm you can print with up to 100mm/s and still bene t from the smoothing e ect.
Speed settings
Always look at the unit of measurement. Feed rates are always in mm/s!
First you should think about your maximum speed your printer can handle. Most printer will be able to handle 100mm/s (except
z axis which is much slower for most printer types). 200mm/s is a solid speed most printer can handle. Fast printers go up to
500mm/s. You should test these values when you installed the rmware. Find the speed where no stepper stalls and reduce this
by 10-20% for safety. The last thing you want are lost steps during print, because your limit was too high. Your motor current has
in uence on your speed, too. Be aware that high currents heat up the motors and drivers which can also lead to lost steps!
Next comes the homing feed rate. This should be much lower then your maximum. The printer needs to stop immediately, when the end stop is triggered
#de ne HOMING_FEEDRATE_X 40
#de ne HOMING_FEEDRATE_Y 40
#de ne HOMING_FEEDRATE_Z 2
Now we come to the acceleration. The firmware distinguishes between travel and printing moves. Travel moves have no influence on print quality, so you
Stepper timings
The default values for stepper timings work perfectly with the Allegro stepper driver chips used on most RepRaps. So only
change them if you think you have a di erent driver which needs slower timings.
The step signal is normally kept high for around 2µs, depending on the situation a bit longer. You can increase this time with
#define STEPPER_HIGH_DELAY 0
Now we come to the tricky part allowing high step rates of 40000 hertz with this little AVR microcontroller. The real limit for
precise positioned stepper pulses lies around 16000 Hz. With this speed over 80% of the computation time is spend in the
stepper routine and leaves not much room for other tasks. The trick is to double or quadruple the number of step signals in one
computation. The frequency, where this starts is
If the frequency is higher, then this value the rmware will double the steps for frequencies of 10000-20000 Hz and quadruple
steps above 20000 Hz. If your printer is no real CNC, it will have no problems with this. Think of it as reducing 1/16th micro
stepping to 1/8th or 1/4th micro stepping.
#define NUM_EXTRUDER 1
Most of you will only have and use one extruder. The rmware is designed to support 2 or 3 extruder. This feature is not tested
at all, so no one can tell if it would work. I‘m working on a printer with double extruder to check the functionality. If you have one,
try it and I will help you with possible problems.
If you have a second extruder, you need to copy the EXT0_ de nitions and rename them to EXT1_ for the con guration of the
second extruder.
#define EXT0_X_OFFSET 0
#define EXT0_Y_OFFSET 0
Printing commands are based on one position for all tools. Switching the extruder needs to move the head, so the second
extruder is exactly at the position of the rst extruder. These coordinates are the di erence to the position of the rst extruder.
How many steps does the motor need to move the lament 1 mm. This is the number for the lament going in, not out!
#define EXT0_TEMPSENSOR_TYPE 5
What temperature sensor are you using in the extruder. The con guration le lists possible values and meanings.
#define EXT0_TEMPSENSOR_PIN 0
This parameter is tricky and often causes wrong con gurations. For historical reasons it is named PIN but it IS NOT A PIN
NUMBER. It is the position in an array of analog input sources. In this array, the real pin number is stored. In 99.9% 0 is the
correct answer here.
Which pin enables the heater block. It works with any pin. PWM capability is not required to use PID on an output.
If your extruder turns in the wrong direction, change the value into true.
// For Inverting Stepper Enable Pins (Active Low) use 0, Non Inverting (Active High) use 1
#define EXT0_ENABLE_ON false
For inverting stepper enable pins (active low) use false, non Inverting (Active High) use true.
#define EXT0_MAX_START_FEEDRATE 18
Starting feed rate in mm/s of your extruder. Normal feed rates are 12-20mm/s depending on motor strength, friction and
extruder type. If your extruder stalls on retractions from the start, reduce this value.
#define EXT0_HEAT_MANAGER 1
#define EXT0_WATCHPERIOD 20
Wait x seconds, after reaching target temperature. Only used for M109.
A good value is slightly higher then the output needed for your temperature.
Depending in your heater these values can vary. If your printer can not hold the target temperature or does not reach it, increase
this value!
#define EXT0_PID_INTEGRAL_DRIVE_MIN 50
Lower value for integral part. The I state should converge to the exact heater output needed for the target temperature. To
prevent a long deviation from the target zone, this value limits the lower value. A good start is 30 lower then the optimal value.
You need to leave room for cooling.
#define EXT0_PID_IGAIN 1
Maximum time the heater can be switched on. Max = 255. This works only with PID. The power dissipated by the heating resistor
is U2/R. If you increase the voltage your resistor may get damaged if you still use full power.
Values to in uence the advance algorithm. Check the advance algorithm chapter for more information. 0 disables the function.
If we need more then JAM_ERROR_STEPS steps, we assume a more serious problem that even reduced speed could not solve
and take the action de ned with JAM_ACTION, preferably something that pauses the running print.
Action 0 does simply print a warning on the LCD and lets the printer beep. Action 1 is my preferred solution, but requires a LCD
screen. It will block
any host communication preventing further print, moves extruder to lament change position and disables temperature and all
motors, which would home
after lament change. Then it waits for the user to react. First click on LCD will reheat extruders. Then you have to wait until all
extruders are back on
temperature. After that you can move extruder with your click encoder to remove lament, test if extrusion works, etc. During
this period jam detection is disabled! Action 2 will request a pause from the host or pause a sd print.
M513 resets the jam signal, so the printer stops complaining about jam and also disables the beeper.
M601 S1 pauses extruder temperatures while M601 S0 restores the temperatures before the pause.
M602 S<1/0> P<1/0> is for debugging jam (S value) or disabling jam control (P value). If you enable jam debug, the rmware will
not execute jam
actions. Instead it will write the signal switch steps and percent values into the host log. That way you can calibrate your 100%
value.
This is also useful to nd out at which extrusion speed the forces get too high, so that extruder starts to slip.
The simplest addition is a single LCD, which shows some current data like extruder/bed temperature or z-level. If you want some
methods of input, you can add keys. The minimum required is three signals. You can use a rotary encoder with push button
function or three plain push buttons. The addition of a complete key matrix up to 4×4 buttons is also possible. For acoustic
feedback, a piezo buzzer can be added.
The current implementation supports direct connection to IO pins of your Arduino or an indirect connection over I2C to a
PCF8574 chip, where the display and keys/buzzer are connected. You need one chip for the display and one for the keys and
buzzer. If you have the pins, use direct connection. It is much faster and less error prone. A rotary encoder over I2C works only
with slow turns!
Hardware connection
Display
The current rmware supports LCD display usinga HD44780 or compatible driver. This is a industrial standard that is found in
nearly all alpha-numeric LCD displays. If you buy one, be careful about the voltage requirements. Some LCDs need negative
voltage for contrast. If you don’t know how to get negative voltages avoid them. There are plenty of displays using only positive
voltages. It’s best to put a 10k poti between 0 and 5V and connect the middle pin to V0. That way you can adjust the contrast any
time. For the backlight a resistor is normally required. Read the specs for the required value. Some LCD have the resistor build in,
so they can be powered with 5V directly. Now connect VSS, DB0, DB1, DB2, DB3 and LED- with GND and VDD with 5V. Connect
RS, R/W, E, DB4, DB5, DB6 and DB7 to io pins of your Arduino or to the signal pins of your PCF8574 chip, if you are connecting the
display over I2C. Then you are done! Make sure you know which pin is connected to which function for later con guration.
Keys
The easiest way is, to connected the keys via gnd to the io pin of your Arduino/PCF8574. It is always a good idea to add a 1K
resistor in line, just in case the pin becomes an output to prevent a short. The internal pull-up will rise the signal to high, until a
button is pushed and draws the line to ground.
You can also connect the keys via 5V, but you need a pull-down resistor on the io side for a de ned signal.
If you have a key matrix you need up to 4 io pins for the driving rows and 1-4 pins for the receiving columns. The voltage on the
rows gets changed between 0 and 5V to detect the active key. If you press 2 keys in the same column at the same time, a short
will happen. To protect your cpu, you should add 1K resistors to each line.
Piezo Buzzer
If you want acoustic feedback, you can add a piezo buzzer. Get one that draw less then 20mA current. If you connect it directly to
your AVR, connect GND – Buzzer – IO pin. If you use PCF8574 you have to connect it this way: 5V – buzzer – PCF8574 pin. Piezo
elements have a plus and a minus contact, don’t run them the wrong way around!
Con guration
All con gurations of the user interface are done in uicon g.h.
Concept
The rmware uses a very exible concept for the user interface. The key behind all this is a exible output command and
assignable actions. So how does it work? Everywhere, where you can de ne some output you can include place holder for special
values like current temperature or z-position. It doesn’t really matter for which function the output was meant, you can show the
temperature in the x-position menu if you like. These placeholder always consist of three chars, beginning with a %. The
following two letter determine the information shown.
List of placeholder
Notice: Some values are only available, if the matching functions are included. E.g. the PID values are only possible if you
compiled with PID support.
The second key concept are actions. An action is de ned by what happens if it is executed. One possible action is home x, so if it
is executed, your extruder will move to x home position. It doesn’t matter what triggered that action. You can assign this to a key
or it can be an action belonging to an menu entry.
Display
First you need to de ne, how your LCD is connected:
#define UI_DISPLAY_TYPE 1
#define UI_COLS 16
#define UI_ROWS 4
Now comes the hard part. You need to identify the pins used to control the display and set them accordingly. The rst de nition
block is for a display connected over I2C. Here you need to set the mask value, not the pin number. That’s why you see _BV(3) for
pin 3 (if you start counting at 0). In addition you need to set the PCF8574 address.
If you use a direct connection you could set the RW pin to -1. If you do this, the rmware will wait UI_DELAYPERCHAR
microseconds after each byte send. The faster method is to have a RW pin, so the rmware can ask the display if it is ready for
the next command.
Keys
The rmware gives you complete freedom over the number and functions of your keys. The price you pay is, you have to write
the key polling code yourself. Don’t worry, the rmware has prede ned macros for the most common types of keys. You have to
put the code into the matching 4 functions used by the rmware. All functions are already de ned in the keys section of
uicon g.h with some commented samples. But before we start with the function, you should de ne some key related de nitions.
Most keys bounce the signal when closed/opened. After a short time the signal stabilizes. There is no need to add debounce
electronics, all needed is to tell the rmware how long your keys bounce. After that, you can de ne key repetition behaviour. The
default values should give a good starting point.
Next you de ne, if you will set the action of one of the keys to UI_ACTION_BACK. If you do, set the value to 0, so the back menü
function at the top is removed. This way you can navigate faster through the menus. If you want the back menu entry, set it to 0
even if you have a back key.
#define UI_HAS_BACK_KEY 1
If you have keys attached over I2C, you need to uncomment the de ne and set the PCF8574 address.
/** Uncomment this, if you have keys connected via i2c to a PCF8574 chip. */
//#define UI_HAS_I2C_KEYS
// Under which address can the key status requested. This is the address of your PCF8574 where the keys are connected-
Ok, now the hard part. We start with the keyboard initialization. This functions is called only once, before the key polling starts.
Here we de ne the pins as input and enable the pull up resistor if required. I2C keys need no code here. Possible macros are
listed in the uicon g le with their description.
void ui_init_keys() {
// UI_KEYS_INIT_CLICKENCODER_LOW(47,45); // click encoder on pins 47 and 45. Phase is connected with gnd for si
// UI_KEYS_INIT_BUTTON_LOW(43); // push button, connects gnd to pin
// UI_KEYS_INIT_MATRIX(32,47,45,43,41,39,37,35);
}
The macros for the next three functions are all the same. They are only caused from di erent points and with di erent
frequencies. The rst function is ui_check_keys. This is called from an interrupt and should nish as fast as possible. The only
thing you should add here is a directly connected encoder. All I2C key methods are strictly forbidden. They take to much time to
be run inside the interrupt. You can add 1-2 directly connected push buttons here if you want.
The second function is ui_check_slow_encoder, which is intended for rotary encodes connected over I2C. This is the only key
macro you should add there. As you see, there is already one included, but you may need to change the type or pins or disable it,
if you use I2C keys without encoder.
The last function is ui_check_slow_keys. Here you add the same key macro as in ui_check_slow_encoder, if you have anything
there plus all keys not de ned until now. This function is called from the main thread and can be interrupted any time, so no big
things happen if it takes some ticks longer.
// UI_KEYS_MATRIX(32,47,45,43,41,39,37,35);
}
Buzzer
You nd the buzzer con guration near the start of the le. The comments should be enough, to understand the con guration.
/**
Beeper sound definitions for short beeps during key actions
and longer beeps for important actions.
Parameter is is delay in microseconds and the secons is the number of repetitions.
Values must be in range 1..255 */
#define BEEPER_SHORT_SEQUENCE 1,1
#define BEEPER_LONG_SEQUENCE 5,5
Menu de nition
At the start of the le you can select the language for your menu. #de ne UI_LANGUAGE 0
0 is english, 1 is german and 2 is dutch. With some luck nice users of the rmware will contribute additional languages. To de ne
your own language go into uilang.h At the end you will nd this, where you can write your own translations:
// *************************************************************************************
// User defined language
//
// If you need a language not mentioned above, you can translate this dummy entry.
// If you want it added permanently to the distribution, spend it to the community under
// GPL V3. Only new and complete translations are put into the official distribution!
// *************************************************************************************
#if UI_LANGUAGE==1000
Thats all needed to get the complete menu and info pages. If you want more information pages or additional menu entries,
other ordering etc. search for
and make your changes. Read the comments and look at the de nitions and you should gasp, how to modify it. Be careful to
update the menu entry counters to match the number of entries!
Privacy Policy