Welcome! Log In Create A New Profile

Advanced

Quick acces Buttons - Firmware question

Posted by codec 
Quick acces Buttons - Firmware question
December 22, 2014 01:46PM
I have 3 free pins on my electronic. I would like to add 3 buttons who will give me quick access to functions:

1 - home all axes
2 - move Z axis 10mm up and extrude 5mm of filament
3 - pause print

Is possible to do this? If YES, please help with repetier firmware settings. I have free SPI also, so maybe buttons over SPI? More quick access buttons needed, but only 3 pins are free sad smiley

Edited 4 time(s). Last edit at 12/22/2014 02:02PM by codec.
Re: Quick acces Buttons - Firmware question
December 22, 2014 03:27PM
You can easily add functions to any pin. Each controller defined has 2 functions as shown below. Here you see only code for simple buttons assigned to a function (UI_ACTION_...). You find a full list in ui.h at the top and can easily define your own action, just search where the other actions are implemented. So all you need to do is extend the 2 functions for your controller with the matching initalization and checkup.

void uiInitKeys() {
  UI_KEYS_INIT_BUTTON_LOW(4); // push button, connects gnd to pin
  UI_KEYS_INIT_BUTTON_LOW(5);
  UI_KEYS_INIT_BUTTON_LOW(6);
  UI_KEYS_INIT_BUTTON_LOW(11);
  UI_KEYS_INIT_BUTTON_LOW(42);
}
void uiCheckKeys(int &action) {
 UI_KEYS_BUTTON_LOW(4,UI_ACTION_OK); // push button, connects gnd to pin
 UI_KEYS_BUTTON_LOW(5,UI_ACTION_NEXT); // push button, connects gnd to pin
 UI_KEYS_BUTTON_LOW(6,UI_ACTION_PREVIOUS); // push button, connects gnd to pin
 UI_KEYS_BUTTON_LOW(11,UI_ACTION_BACK); // push button, connects gnd to pin
 UI_KEYS_BUTTON_LOW(42,UI_ACTION_SD_PRINT ); // push button, connects gnd to pin
}


Repetier-Software - the home of Repetier-Host (Windows, Linux and Mac OS X) and Repetier-Firmware.
Repetier-Server - the solution to control your printer from everywhere.
Visit us on Facebook and Twitter!
Re: Quick acces Buttons - Firmware question
February 25, 2015 11:59AM
Dear Repetier,

I've been trying to use a physical push button to do an EMERGENCY STOP during printing.

This is what I've done:

1)
#define UI_HAS_KEYS 1

2)
void ui_init_keys() {
#if UI_HAS_KEYS!=0

UI_KEYS_INIT_BUTTON_LOW(42);


#endif
}

3)
void ui_check_keys(int &action) {
#if UI_HAS_KEYS!=0


UI_KEYS_BUTTON_LOW(42,UI_ACTION_EMERGENCY_STOP); // push button, connects gnd to pin

#endif
}

4)
Connected a push button (if not pressed, it's open) in series with a 1k-resistor from GND pin on AUX4 to pin 42 on AUX2 (see attachment).


It's seems to be very easy, but for some reason, when I press the push button, nothing happens. The print just keeps going.
Anything totally missing here?

I've gone through a lot of forums, but never found anything but the description you gave above.

Thanks in advance for any help!

HOST is Repetier V1.0.6
RAMPS 1.4.2
FIRMWARE is Repetier. Don't know the version, but downloaded February 3rd 2015

Edited 1 time(s). Last edit at 02/25/2015 12:05PM by dr.shirota.
Attachments:
open | download - switch.jpg (229 KB)
Re: Quick acces Buttons - Firmware question
March 03, 2015 07:12AM
Code looks ok, but you should test if the part where you included it gets included. That button code is at 20 places and only one gets used, so it's probably only not compiled. For testing this I simple add

#error comliles

in the part I want to test and then I should get a compile error for that line, knowing it gets at least compiled.


Repetier-Software - the home of Repetier-Host (Windows, Linux and Mac OS X) and Repetier-Firmware.
Repetier-Server - the solution to control your printer from everywhere.
Visit us on Facebook and Twitter!
Sorry, only registered users may post in this forum.

Click here to login