sync
rodzic
139828df88
commit
d18e3d7e83
|
@ -23,7 +23,6 @@ before_script:
|
|||
- wget http://downloads.arduino.cc/gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz
|
||||
- tar xf gcc-arm-none-eabi-4.8.3-2014q1-linux64.tar.gz
|
||||
- mv gcc-arm-none-eabi-4.8.3-2014q1 4.8.3-2014q1
|
||||
- cp -f "$TRAVIS_BUILD_DIR/src/ArduinoDUE/AdditionalArduinoFiles/Arduino - 1.6.5 -Due 1.6.4/Arduino15/packages/hardware/sam/1.6.4/variants/arduino_due_x/variant.cpp" $HOME/.arduino15/packages/hardware/sam/1.6.4/variants/arduino_due_x/variant.cpp
|
||||
|
||||
|
||||
script:
|
||||
|
|
67
README.md
67
README.md
|
@ -1,12 +1,17 @@
|
|||
##Da Vinci Firmware based on Repetier (0.92)
|
||||
============================
|
||||
|
||||
This firmware is based on the popular repetier firmware and modified to work with first generation Da Vinci 1.0, 2.0 single fan and 2.0.
|
||||
[![Join the chat at https://gitter.im/luc-github/Repetier-Firmware-0.92](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/luc-github/Repetier-Firmware-0.92?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
This firmware is based on the popular repetier firmware and modified to work with first generation Da Vinci 1.0, 2.0 single fan, 2.0 dual fans and also AiO (NB:scanner function is not supported so AiO will work like an 1.0A)
|
||||
If you change the board, currently DUE based are supported with RADDS, as well as Graphical screen and LCD with encoder, there are some sample configuration files provided for RADDS/DUE/GLCD using 1/128 step drivers.
|
||||
|
||||
YOU MIGHT DAMAGE YOUR PRINTER OR VOID YOUR WARRANTY, DO IT ON YOUR OWN RISK. When it is possible on 1.0/2.0, currently on 1.0A/2.0A and AiO there is no way to revert to stock fw so be sure of what you are doing.
|
||||
|
||||
***
|
||||
###Support for 1.0A/2.0A is implemented and need feedback
|
||||
###Support for 1.0A/2.0A/AiO(no scanner) is implemented and need feedback.
|
||||
|
||||
The board can be easily exposed by removing the back panel of the printer secured by two torx screws. Supported boards have a jumper labeled JP1. Unsupported second generation boards have a jumper labeled J37. More info can be found on the [Voltivo forum](http://voltivo.com/forum/davinci-peersupport/340-new-kind-of-mainboard-no-j1-erase-jumper).
|
||||
The board can be easily exposed by removing the back panel of the printer secured by two torx screws. Supported boards have a jumper labeled JP1, second generation boards have a jumper labeled J37. More info can be found on the [Voltivo forum](http://voltivo.com/forum/davinci-peersupport/340-new-kind-of-mainboard-no-j1-erase-jumper).
|
||||
***
|
||||
|
||||
Here are just a few of the benifits of using this firmware:
|
||||
|
@ -15,7 +20,7 @@ Here are just a few of the benifits of using this firmware:
|
|||
* It works stand alone if you use a WIFI SD Card.
|
||||
* It allows the use of clear ABS (by disabling optical sensors), as well as other arbitrary filament brands/types as temperatures can be controlled freely and there is no requirement for chiped cartridges.
|
||||
|
||||
You can find more info on the [Voltivo forum](http://voltivo.com/forum/davinci-firmware).
|
||||
You can find more info on the [Voltivo forum](http://voltivo.com/forum/davinci-firmware).
|
||||
|
||||
The current firmware is based on [repetier Firmware](https://github.com/repetier/Repetier-Firmware) 0.92 : [bgm370 Da Vinci 1.0 FW](https://github.com/bgm370/Repetier-Firmware)
|
||||
Sources are [here](https://github.com/luc-github/Repetier-Firmware-0.92)
|
||||
|
@ -23,43 +28,51 @@ The previous version (based on repetier v0.91) can be found [here](https://githu
|
|||
|
||||
***
|
||||
##Current Status
|
||||
####Alpha 1 - ready for testing
|
||||
####Beta - so far so good
|
||||
|
||||
***
|
||||
##Installation
|
||||
1. With the machine off remove the back panel and short the jumper JP1. Some Boards do not have jumper pins exposed but can still be shorted with a conductive wire.
|
||||
1. With the machine off remove the back panel and short the jumper JP1 or J37 depending on model. Some Boards do not have jumper pins exposed but can still be shorted with a conductive wire.
|
||||
2. Turn the machine on and wait a few seconds then turn it off again. The machine will have been flashed removing the current stock firmware and allowing it to be detected as a normal arduino DUE. NOTE: Windows users may need to install drivers to detect the board. Consult the Voltivo forums.
|
||||
3. Use an arduino IDE supporting arduino DUE, [version 1.5.8+ Not 1.6.0](http://arduino.cc/en/Main/OldSoftwareReleases), 1.6.0 bring several issues - a [tracker](https://github.com/luc-github/Repetier-Firmware-0.92/issues/51) is open to follow up .
|
||||
4. Update arduino files (variants.cpp and USBcore.cpp) with the one(s) present in src\ArduinoDUE\AdditionalArduinoFiles\1.5.8. or in src\ArduinoDUE\AdditionalArduinoFiles\1.6.0 according your IDE version
|
||||
3. Use an arduino IDE supporting arduino DUE, [version 1.5.8+ or 1.6.5](http://arduino.cc/en/Main/OldSoftwareReleases), 1.6.0+ bring several issues, but 1.6.5 seems working well with Due 1.6.4 module for board manager.
|
||||
4. Update arduino files (variants.cpp and USBcore.cpp) with the one(s) present in src\ArduinoDUE\AdditionalArduinoFiles\1.5.8. or in src\ArduinoDUE\AdditionalArduinoFiles\1.6.5 according your IDE version
|
||||
NOTE: You do not need to compile arduino from source these files are in the arduino directory structure. On Mac you will need to right click on the Arduino.app to Show Package Contents.
|
||||
5. Open the project file named repetier.ino located in src\ArduinoDUE\Repetier directory in the arduino IDE.
|
||||
6. Modify the DAVINCI define in Configuration.h file to match your targeted Da Vinci. See below.
|
||||
7. Under the tools menu select the board type as Arduino DUE (Native USB Port) and the proper port you have connected to the printer. NOTE: You can usually find this out by looking at the tools -> port menu both before and after plugging in the printer to your computer's USB.
|
||||
8. Press the usual arduino compile and upload button.
|
||||
If done correctly you will see the arduino sketch compile successfully and output in the log showing the upload status.
|
||||
9. Once flash is done <B>do not forget to send G-Code M502 then M500 </B>from repetier's Print Panel tab <B>or from the printer menu "Settings/Load Fail-Safe"</B> and accept to save the new eeprom settings.
|
||||
10. When update is complete <B>you must calibrate your bed height!</B>
|
||||
9. Once flash is done : restart printer
|
||||
10. After printer restarted <B>do not forget to send G-Code M502 then M500 </B>from repetier's Print Panel tab <B>or from the printer menu "Settings/Load Fail-Safe"</B> and accept to save the new eeprom settings.
|
||||
11. When update is complete <B>you must calibrate your bed height!</B>
|
||||
You can do so by homeing all axis, turning off the printer and manually adjusting the bed leveling screws until the glass bed is just under the nozzle at each end of the bed. While the printer is powered off you can move the print head by hand and slide a piece of paper over the glass bed and under the nozzle with a slight pull on the paper from the nozzle.
|
||||
11. Next you can calibrate your filament as usual.
|
||||
12. Next you can calibrate your filament as usual, and second extruder offset if you have.
|
||||
|
||||
For information on upgrading from or reverting to stock FW and other procedures please check [Da Vinci Voltivo forum](http://voltivo.com/forum/davinci).
|
||||
<h4>:warning:There is no known way to revert to stock FW on 1.0A/2.0A/AiO until today.</h4>
|
||||
|
||||
Do not forget to modify the configuration.h to match your targeted Da Vinci: 1.0, 2.0 SF or 2.0.
|
||||
for basic installation just change :
|
||||
'<code>#define DAVINCI 1 // "1" For DAVINCI 1.0, "2" For DAVINCI 2.0 with 1 FAN, "3" For DAVINCI 2.0 with 2 FANS</code>'
|
||||
|
||||
'<code>#define DAVINCI 1 // "1" For DAVINCI 1.0, "2" For DAVINCI 2.0 with 1 FAN, "3" For DAVINCI 2.0 with 2 FANS, 4 For AiO (no scanner)</code>'
|
||||
0 for not Davinci board (like DUE/RADDS)
|
||||
1 for DaVinci 1.0 (1Fan, 1 Extruder)
|
||||
2 for DaVinci 2.0 SF (1Fan, 2 Extruders)
|
||||
3 for DaVinci 2.0 (2Fans, 2 Extruders)
|
||||
3 for DaVinci 2.0 (2Fans, 2 Extruders)
|
||||
4 for DaVinci AiO (no scanner)
|
||||
|
||||
Support for 1.0A and 2.0A: need to change <CODE>#define MODEL 0</CODE> to <CODE>#define MODEL 1</CODE>
|
||||
|
||||
To repurpose the main Extruder cooling fan to be controlled VIA G-Code instructions M106/M107:
|
||||
Set REPURPOSE_FAN_TO_COOL_EXTRUSIONS to 1, do not forget to add a fan with power source to cool extruder permanently if you use this option.
|
||||
|
||||
Another excellent tutorial for flashing and installation is here from Jake : http://voltivo.com/forum/davinci-peersupport/501-da-vinci-setup-guide-from-installation-to-wireless-printing
|
||||
|
||||
Or a great video done by Daniel Gonos: https://www.youtube.com/watch?v=rjuCvlnpB7M
|
||||
|
||||
***
|
||||
##TODO
|
||||
[Check issue list](https://github.com/luc-github/Repetier-Firmware-0.92/issues)
|
||||
##TODO or Questions ?
|
||||
[Check issue list](https://github.com/luc-github/Repetier-Firmware-0.92/issues)
|
||||
[FAQ](https://github.com/luc-github/Repetier-Firmware-0.92/issues?utf8=%E2%9C%93&q=is%3Aclosed+label%3AFAQ+)
|
||||
|
||||
***
|
||||
##Implemented
|
||||
|
@ -67,22 +80,24 @@ Set REPURPOSE_FAN_TO_COOL_EXTRUSIONS to 1, do not forget to add a fan with power
|
|||
* Single/Dual extruders support (DaVinci 1.0/2.0 all generations but AiO)
|
||||
* Single Fan / Dual fans support according printer configuration
|
||||
* Repurpose of second fan usage to be controlled by M106/M107 commands on Da Vinci 2.0
|
||||
* Sound and Light management, including powersaving function (light can be managed remotely by GCODE)
|
||||
* Cleaning Nozzle(s) by menu and by GCODE for 1.0 and 2.0
|
||||
* Sound and Lights management, including powersaving function (light can be managed remotely by GCODE)
|
||||
* Cleaning Nozzle(s) by menu and by GCODE for 1.0, 2.0 and AiO
|
||||
* Load / Unload filament by menu
|
||||
* Filament Sensor support for 1.0 and 2.0 (auto loading / alert if no filament when printing)
|
||||
* Auto Z-probe for 1.0 and 2.0
|
||||
* Manual Leveling for 1.0 and 2.0
|
||||
* Dripbox cleaning
|
||||
* Advanced/Easy menu (switch in "Settings/Mode" or using Up key/Right key/ Ok key in same time)
|
||||
* Filament Sensor support (auto loading / alert if no filament when printing)
|
||||
* Auto Z-probe
|
||||
* Manual Leveling
|
||||
* Dripbox cleaning for 1.0/2.0
|
||||
* Customized Menu UI with Advanced/Easy mode (switch in "Settings/Mode" or using Up key/Right key/ Ok key in same time)
|
||||
* Loading FailSafe settings
|
||||
* Emergency stop (Left key/Down key/Ok key in same time)
|
||||
* Increase extruder temperature range to 270C and bed to 130C
|
||||
* Add temperature control on extruder to avoid movement if too cold
|
||||
* Add fast switch (1/10/100mm) for manual position/extrusion
|
||||
* Preheat bed for slow response time heat bed sensors
|
||||
* Several fixes from original FW
|
||||
* Watchdog
|
||||
* Command for bed down
|
||||
* Several fixes from original FW
|
||||
* Watchdog
|
||||
* Basic Wifi support for module ESP8266 (https://github.com/luc-github/ESP8266/blob/master/README.md#result-of-esp12e-on-davinci)
|
||||
* Customized thermistor tables for bed and extruder(s) as Davinci board do not follow design of others 3D printer boards so standard tables do not work properly [check here](http://voltivo.com/forum/davinci-firmware/438-repetier-91-e3d-v6-extruder#3631)
|
||||
* More to come ....
|
||||
|
||||
***
|
||||
|
|
BIN
pinout.xlsx
BIN
pinout.xlsx
Plik binarny nie jest wyświetlany.
|
@ -0,0 +1,891 @@
|
|||
// Copyright (c) 2010, Peter Barrett
|
||||
/*
|
||||
** Permission to use, copy, modify, and/or distribute this software for
|
||||
** any purpose with or without fee is hereby granted, provided that the
|
||||
** above copyright notice and this permission notice appear in all copies.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
|
||||
** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
|
||||
** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
** SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "USBAPI.h"
|
||||
#include "Reset.h"
|
||||
#include <stdio.h>
|
||||
|
||||
//#define TRACE_CORE(x) x
|
||||
#define TRACE_CORE(x)
|
||||
|
||||
static const uint32_t EndPoints[] =
|
||||
{
|
||||
EP_TYPE_CONTROL,
|
||||
|
||||
#ifdef CDC_ENABLED
|
||||
EP_TYPE_INTERRUPT_IN, // CDC_ENDPOINT_ACM
|
||||
EP_TYPE_BULK_OUT, // CDC_ENDPOINT_OUT
|
||||
EP_TYPE_BULK_IN, // CDC_ENDPOINT_IN
|
||||
#endif
|
||||
|
||||
#ifdef HID_ENABLED
|
||||
EP_TYPE_INTERRUPT_IN_HID // HID_ENDPOINT_INT
|
||||
#endif
|
||||
};
|
||||
|
||||
/** Pulse generation counters to keep track of the number of milliseconds remaining for each pulse type */
|
||||
#define TX_RX_LED_PULSE_MS 100
|
||||
volatile uint8_t TxLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */
|
||||
volatile uint8_t RxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */
|
||||
static char isRemoteWakeUpEnabled = 0;
|
||||
static char isEndpointHalt = 0;
|
||||
//==================================================================
|
||||
//==================================================================
|
||||
|
||||
extern const uint16_t STRING_LANGUAGE[];
|
||||
extern const uint8_t STRING_PRODUCT[];
|
||||
extern const uint8_t STRING_MANUFACTURER[];
|
||||
extern const DeviceDescriptor USB_DeviceDescriptor;
|
||||
extern const DeviceDescriptor USB_DeviceDescriptorA;
|
||||
|
||||
const uint16_t STRING_LANGUAGE[2] = {
|
||||
(3<<8) | (2+2),
|
||||
0x0409 // English
|
||||
};
|
||||
|
||||
#ifndef USB_PRODUCT
|
||||
// Use a hardcoded product name if none is provided
|
||||
#if USB_PID == USB_PID_DUE
|
||||
#define USB_PRODUCT "Arduino Due"
|
||||
#else
|
||||
#define USB_PRODUCT "USB IO Board"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const uint8_t STRING_PRODUCT[] = USB_PRODUCT;
|
||||
|
||||
#if USB_VID == 0x2341
|
||||
# if defined(USB_MANUFACTURER)
|
||||
# undef USB_MANUFACTURER
|
||||
# endif
|
||||
# define USB_MANUFACTURER "Arduino LLC"
|
||||
#elif !defined(USB_MANUFACTURER)
|
||||
// Fall through to unknown if no manufacturer name was provided in a macro
|
||||
# define USB_MANUFACTURER "Unknown"
|
||||
#endif
|
||||
|
||||
const uint8_t STRING_MANUFACTURER[12] = USB_MANUFACTURER;
|
||||
|
||||
#ifdef CDC_ENABLED
|
||||
#define DEVICE_CLASS 0x02
|
||||
#else
|
||||
#define DEVICE_CLASS 0x00
|
||||
#endif
|
||||
|
||||
// DEVICE DESCRIPTOR
|
||||
const DeviceDescriptor USB_DeviceDescriptor =
|
||||
D_DEVICE(0x00,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
|
||||
|
||||
const DeviceDescriptor USB_DeviceDescriptorA =
|
||||
D_DEVICE(DEVICE_CLASS,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
|
||||
|
||||
const DeviceDescriptor USB_DeviceQualifier =
|
||||
D_QUALIFIER(0x00,0x00,0x00,64,1);
|
||||
|
||||
//! 7.1.20 Test Mode Support
|
||||
static const unsigned char test_packet_buffer[] = {
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // JKJKJKJK * 9
|
||||
0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA, // JJKKJJKK * 8
|
||||
0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE,0xEE, // JJJJKKKK * 8
|
||||
0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, // JJJJJJJKKKKKKK * 8
|
||||
0x7F,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD, // JJJJJJJK * 8
|
||||
0xFC,0x7E,0xBF,0xDF,0xEF,0xF7,0xFB,0xFD,0x7E // {JKKKKKKK * 10}, JK
|
||||
};
|
||||
|
||||
//==================================================================
|
||||
//==================================================================
|
||||
|
||||
volatile uint32_t _usbConfiguration = 0;
|
||||
volatile uint32_t _usbInitialized = 0;
|
||||
uint32_t _usbSetInterface = 0;
|
||||
uint32_t _cdcComposite = 0;
|
||||
|
||||
//==================================================================
|
||||
//==================================================================
|
||||
|
||||
#define USB_RECV_TIMEOUT
|
||||
class LockEP
|
||||
{
|
||||
irqflags_t flags;
|
||||
public:
|
||||
LockEP(uint32_t ep) : flags(cpu_irq_save())
|
||||
{
|
||||
}
|
||||
~LockEP()
|
||||
{
|
||||
cpu_irq_restore(flags);
|
||||
}
|
||||
};
|
||||
|
||||
// Number of bytes, assumes a rx endpoint
|
||||
uint32_t USBD_Available(uint32_t ep)
|
||||
{
|
||||
LockEP lock(ep);
|
||||
return UDD_FifoByteCount(ep & 0xF);
|
||||
}
|
||||
|
||||
// Non Blocking receive
|
||||
// Return number of bytes read
|
||||
uint32_t USBD_Recv(uint32_t ep, void* d, uint32_t len)
|
||||
{
|
||||
if (!_usbConfiguration)
|
||||
return -1;
|
||||
|
||||
LockEP lock(ep);
|
||||
uint32_t n = UDD_FifoByteCount(ep & 0xF);
|
||||
len = min(n,len);
|
||||
n = len;
|
||||
uint8_t* dst = (uint8_t*)d;
|
||||
while (n--)
|
||||
*dst++ = UDD_Recv8(ep & 0xF);
|
||||
if (len && !UDD_FifoByteCount(ep & 0xF)) // release empty buffer
|
||||
UDD_ReleaseRX(ep & 0xF);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
// Recv 1 byte if ready
|
||||
uint32_t USBD_Recv(uint32_t ep)
|
||||
{
|
||||
uint8_t c;
|
||||
if (USBD_Recv(ep & 0xF, &c, 1) != 1)
|
||||
return -1;
|
||||
else
|
||||
return c;
|
||||
}
|
||||
|
||||
// Space in send EP
|
||||
//uint32_t USBD_SendSpace(uint32_t ep)
|
||||
//{
|
||||
//LockEP lock(ep);
|
||||
//// if (!UDD_ReadWriteAllowed(ep & 0xF))
|
||||
////{
|
||||
////printf("pb "); // UOTGHS->UOTGHS_DEVEPTISR[%d]=0x%X\n\r", ep, UOTGHS->UOTGHS_DEVEPTISR[ep]);
|
||||
////return 0;
|
||||
////}
|
||||
|
||||
//if(ep==0) return 64 - UDD_FifoByteCount(ep & 0xF); // EP0_SIZE jcb
|
||||
//else return 512 - UDD_FifoByteCount(ep & 0xF); // EPX_SIZE jcb
|
||||
//}
|
||||
|
||||
// Blocking Send of data to an endpoint
|
||||
uint32_t USBD_Send(uint32_t ep, const void* d, uint32_t len)
|
||||
{
|
||||
uint32_t n;
|
||||
int r = len;
|
||||
const uint8_t* data = (const uint8_t*)d;
|
||||
|
||||
if (!_usbConfiguration)
|
||||
{
|
||||
TRACE_CORE(printf("pb conf\n\r");)
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (len)
|
||||
{
|
||||
if(ep==0) n = EP0_SIZE;
|
||||
else n = EPX_SIZE;
|
||||
if (n > len)
|
||||
n = len;
|
||||
len -= n;
|
||||
int count=0;
|
||||
while( UOTGHS_DEVEPTISR_TXINI != (UOTGHS->UOTGHS_DEVEPTISR[ep & 0xF] & UOTGHS_DEVEPTISR_TXINI ))
|
||||
{
|
||||
count++;
|
||||
if (count>10000) return len;
|
||||
}
|
||||
UDD_Send(ep & 0xF, data, n);
|
||||
data += n;
|
||||
}
|
||||
//TXLED1; // light the TX LED
|
||||
//TxLEDPulse = TX_RX_LED_PULSE_MS;
|
||||
return r;
|
||||
}
|
||||
|
||||
int _cmark;
|
||||
int _cend;
|
||||
|
||||
void USBD_InitControl(int end)
|
||||
{
|
||||
_cmark = 0;
|
||||
_cend = end;
|
||||
}
|
||||
|
||||
// Clipped by _cmark/_cend
|
||||
int USBD_SendControl(uint8_t flags, const void* d, uint32_t len)
|
||||
{
|
||||
const uint8_t* data = (const uint8_t*)d;
|
||||
uint32_t length = len;
|
||||
uint32_t sent = 0;
|
||||
uint32_t pos = 0;
|
||||
|
||||
TRACE_CORE(printf("=> USBD_SendControl TOTAL len=%lu\r\n", len);)
|
||||
|
||||
if (_cmark < _cend)
|
||||
{
|
||||
while (len > 0)
|
||||
{
|
||||
sent = UDD_Send(EP0, data + pos, len);
|
||||
TRACE_CORE(printf("=> USBD_SendControl sent=%lu\r\n", sent);)
|
||||
pos += sent;
|
||||
len -= sent;
|
||||
}
|
||||
}
|
||||
|
||||
_cmark += length;
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
// Send a USB descriptor string. The string is stored as a
|
||||
// plain ASCII string but is sent out as UTF-16 with the
|
||||
// correct 2-byte prefix
|
||||
static bool USB_SendStringDescriptor(const uint8_t *string, int wLength) {
|
||||
uint16_t buff[64];
|
||||
int l = 1;
|
||||
wLength-=2;
|
||||
while (*string && wLength>0) {
|
||||
buff[l++] = (uint8_t)(*string++);
|
||||
wLength-=2;
|
||||
}
|
||||
buff[0] = (3<<8) | (l*2);
|
||||
return USBD_SendControl(0, (uint8_t*)buff, l*2);
|
||||
}
|
||||
|
||||
// Does not timeout or cross fifo boundaries
|
||||
// Will only work for transfers <= 64 bytes
|
||||
// TODO
|
||||
int USBD_RecvControl(void* d, uint32_t len)
|
||||
{
|
||||
UDD_WaitOUT();
|
||||
UDD_Recv(EP0, (uint8_t*)d, len);
|
||||
UDD_ClearOUT();
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
// Handle CLASS_INTERFACE requests
|
||||
bool USBD_ClassInterfaceRequest(Setup& setup)
|
||||
{
|
||||
uint8_t i = setup.wIndex;
|
||||
|
||||
TRACE_CORE(printf("=> USBD_ClassInterfaceRequest\r\n");)
|
||||
|
||||
#ifdef CDC_ENABLED
|
||||
if (CDC_ACM_INTERFACE == i)
|
||||
{
|
||||
return CDC_Setup(setup);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HID_ENABLED
|
||||
if (HID_INTERFACE == i)
|
||||
{
|
||||
return HID_Setup(setup);
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int USBD_SendInterfaces(void)
|
||||
{
|
||||
int total = 0;
|
||||
uint8_t interfaces = 0;
|
||||
|
||||
#ifdef CDC_ENABLED
|
||||
total = CDC_GetInterface(&interfaces);
|
||||
#endif
|
||||
|
||||
#ifdef HID_ENABLED
|
||||
total += HID_GetInterface(&interfaces);
|
||||
#endif
|
||||
|
||||
total = total; // Get rid of compiler warning
|
||||
TRACE_CORE(printf("=> USBD_SendInterfaces, total=%d interfaces=%d\r\n", total, interfaces);)
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
int USBD_SendOtherInterfaces(void)
|
||||
{
|
||||
int total = 0;
|
||||
uint8_t interfaces = 0;
|
||||
|
||||
#ifdef CDC_ENABLED
|
||||
total = CDC_GetOtherInterface(&interfaces);
|
||||
#endif
|
||||
|
||||
#ifdef HID_ENABLED
|
||||
total += HID_GetInterface(&interfaces);
|
||||
#endif
|
||||
|
||||
total = total; // Get rid of compiler warning
|
||||
TRACE_CORE(printf("=> USBD_SendInterfaces, total=%d interfaces=%d\r\n", total, interfaces);)
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
// Construct a dynamic configuration descriptor
|
||||
// This really needs dynamic endpoint allocation etc
|
||||
// TODO
|
||||
static bool USBD_SendConfiguration(int maxlen)
|
||||
{
|
||||
// Count and measure interfaces
|
||||
USBD_InitControl(0);
|
||||
//TRACE_CORE(printf("=> USBD_SendConfiguration _cmark1=%d\r\n", _cmark);)
|
||||
int interfaces = USBD_SendInterfaces();
|
||||
//TRACE_CORE(printf("=> USBD_SendConfiguration _cmark2=%d\r\n", _cmark);)
|
||||
//TRACE_CORE(printf("=> USBD_SendConfiguration sizeof=%d\r\n", sizeof(ConfigDescriptor));)
|
||||
|
||||
_Pragma("pack(1)")
|
||||
ConfigDescriptor config = D_CONFIG(_cmark + sizeof(ConfigDescriptor),interfaces);
|
||||
_Pragma("pack()")
|
||||
//TRACE_CORE(printf("=> USBD_SendConfiguration clen=%d\r\n", config.clen);)
|
||||
|
||||
//TRACE_CORE(printf("=> USBD_SendConfiguration maxlen=%d\r\n", maxlen);)
|
||||
|
||||
// Now send them
|
||||
USBD_InitControl(maxlen);
|
||||
USBD_SendControl(0,&config,sizeof(ConfigDescriptor));
|
||||
USBD_SendInterfaces();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool USBD_SendOtherConfiguration(int maxlen)
|
||||
{
|
||||
// Count and measure interfaces
|
||||
USBD_InitControl(0);
|
||||
//TRACE_CORE(printf("=> USBD_SendConfiguration _cmark1=%d\r\n", _cmark);)
|
||||
int interfaces = USBD_SendOtherInterfaces();
|
||||
//TRACE_CORE(printf("=> USBD_SendConfiguration _cmark2=%d\r\n", _cmark);)
|
||||
//TRACE_CORE(printf("=> USBD_SendConfiguration sizeof=%d\r\n", sizeof(ConfigDescriptor));)
|
||||
|
||||
_Pragma("pack(1)")
|
||||
ConfigDescriptor config = D_OTHERCONFIG(_cmark + sizeof(ConfigDescriptor),interfaces);
|
||||
_Pragma("pack()")
|
||||
//TRACE_CORE(printf("=> USBD_SendConfiguration clen=%d\r\n", config.clen);)
|
||||
|
||||
//TRACE_CORE(printf("=> USBD_SendConfiguration maxlen=%d\r\n", maxlen);)
|
||||
|
||||
// Now send them
|
||||
USBD_InitControl(maxlen);
|
||||
USBD_SendControl(0,&config,sizeof(ConfigDescriptor));
|
||||
USBD_SendOtherInterfaces();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool USBD_SendDescriptor(Setup& setup)
|
||||
{
|
||||
uint8_t t = setup.wValueH;
|
||||
uint8_t desc_length = 0;
|
||||
const uint8_t* desc_addr = 0;
|
||||
|
||||
if (USB_CONFIGURATION_DESCRIPTOR_TYPE == t)
|
||||
{
|
||||
TRACE_CORE(printf("=> USBD_SendDescriptor : USB_CONFIGURATION_DESCRIPTOR_TYPE length=%d\r\n", setup.wLength);)
|
||||
return USBD_SendConfiguration(setup.wLength);
|
||||
}
|
||||
|
||||
USBD_InitControl(setup.wLength);
|
||||
#ifdef HID_ENABLED
|
||||
if (HID_REPORT_DESCRIPTOR_TYPE == t)
|
||||
{
|
||||
TRACE_CORE(puts("=> USBD_SendDescriptor : HID_REPORT_DESCRIPTOR_TYPE\r\n");)
|
||||
return HID_GetDescriptor(t);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (USB_DEVICE_DESCRIPTOR_TYPE == t)
|
||||
{
|
||||
TRACE_CORE(puts("=> USBD_SendDescriptor : USB_DEVICE_DESCRIPTOR_TYPE\r\n");)
|
||||
if (setup.wLength == 8)
|
||||
{
|
||||
_cdcComposite = 1;
|
||||
}
|
||||
desc_addr = _cdcComposite ? (const uint8_t*)&USB_DeviceDescriptorA : (const uint8_t*)&USB_DeviceDescriptor;
|
||||
if( *desc_addr > setup.wLength ) {
|
||||
desc_length = setup.wLength;
|
||||
}
|
||||
}
|
||||
else if (USB_STRING_DESCRIPTOR_TYPE == t)
|
||||
{
|
||||
TRACE_CORE(puts("=> USBD_SendDescriptor : USB_STRING_DESCRIPTOR_TYPE\r\n");)
|
||||
if (setup.wValueL == 0) {
|
||||
desc_addr = (const uint8_t*)&STRING_LANGUAGE;
|
||||
}
|
||||
else if (setup.wValueL == IPRODUCT) {
|
||||
return USB_SendStringDescriptor(STRING_PRODUCT, setup.wLength);
|
||||
}
|
||||
else if (setup.wValueL == IMANUFACTURER) {
|
||||
return USB_SendStringDescriptor(STRING_MANUFACTURER, setup.wLength);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
if( *desc_addr > setup.wLength ) {
|
||||
desc_length = setup.wLength;
|
||||
}
|
||||
}
|
||||
else if (USB_DEVICE_QUALIFIER == t)
|
||||
{
|
||||
// Device qualifier descriptor requested
|
||||
desc_addr = (const uint8_t*)&USB_DeviceQualifier;
|
||||
if( *desc_addr > setup.wLength ) {
|
||||
desc_length = setup.wLength;
|
||||
}
|
||||
}
|
||||
else if (USB_OTHER_SPEED_CONFIGURATION == t)
|
||||
{
|
||||
// Other configuration descriptor requested
|
||||
return USBD_SendOtherConfiguration(setup.wLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf("Device ERROR");
|
||||
}
|
||||
|
||||
if (desc_addr == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (desc_length == 0)
|
||||
{
|
||||
desc_length = *desc_addr;
|
||||
}
|
||||
|
||||
TRACE_CORE(printf("=> USBD_SendDescriptor : desc_addr=%p desc_length=%d\r\n", desc_addr, desc_length);)
|
||||
USBD_SendControl(0, desc_addr, desc_length);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static void USB_SendZlp( void )
|
||||
{
|
||||
while( UOTGHS_DEVEPTISR_TXINI != (UOTGHS->UOTGHS_DEVEPTISR[0] & UOTGHS_DEVEPTISR_TXINI ) )
|
||||
{
|
||||
if((UOTGHS->UOTGHS_DEVISR & UOTGHS_DEVISR_SUSP) == UOTGHS_DEVISR_SUSP)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
UOTGHS->UOTGHS_DEVEPTICR[0] = UOTGHS_DEVEPTICR_TXINIC;
|
||||
}
|
||||
|
||||
|
||||
static void Test_Mode_Support( uint8_t wIndex )
|
||||
{
|
||||
uint8_t i;
|
||||
uint8_t *ptr_dest = (uint8_t *) &udd_get_endpoint_fifo_access8(2);
|
||||
|
||||
switch( wIndex )
|
||||
{
|
||||
case 4:
|
||||
//Test mode Test_Packet:
|
||||
//Upon command, a port must repetitively transmit the following test packet until
|
||||
//the exit action is taken. This enables the testing of rise and fall times, eye
|
||||
//patterns, jitter, and any other dynamic waveform specifications.
|
||||
//The test packet is made up by concatenating the following strings.
|
||||
//(Note: For J/K NRZI data, and for NRZ data, the bit on the left is the first one
|
||||
//transmitted. "S" indicates that a bit stuff occurs, which inserts an "extra" NRZI data bit.
|
||||
//"* N" is used to indicate N occurrences of a string of bits or symbols.)
|
||||
//A port in Test_Packet mode must send this packet repetitively. The inter-packet timing
|
||||
//must be no less than the minimum allowable inter-packet gap as defined in Section 7.1.18 and
|
||||
//no greater than 125 us.
|
||||
|
||||
// Send ZLP
|
||||
USB_SendZlp();
|
||||
|
||||
UOTGHS->UOTGHS_DEVDMA[0].UOTGHS_DEVDMACONTROL = 0; // raz
|
||||
UOTGHS->UOTGHS_DEVDMA[1].UOTGHS_DEVDMACONTROL = 0; // raz
|
||||
|
||||
// Configure endpoint 2, 64 bytes, direction IN, type BULK, 1 bank
|
||||
UOTGHS->UOTGHS_DEVEPTCFG[2] = UOTGHS_DEVEPTCFG_EPSIZE_64_BYTE
|
||||
| UOTGHS_DEVEPTCFG_EPDIR_IN
|
||||
| UOTGHS_DEVEPTCFG_EPTYPE_BLK
|
||||
| UOTGHS_DEVEPTCFG_EPBK_1_BANK;
|
||||
// Check if the configuration is ok
|
||||
UOTGHS->UOTGHS_DEVEPTCFG[2] |= UOTGHS_DEVEPTCFG_ALLOC;
|
||||
while((UOTGHS->UOTGHS_DEVEPTISR[2]&UOTGHS_DEVEPTISR_CFGOK)==0) {}
|
||||
UOTGHS->UOTGHS_DEVEPT |= UOTGHS_DEVEPT_EPEN2;
|
||||
// Write FIFO
|
||||
for( i=0; i<sizeof(test_packet_buffer); i++)
|
||||
{
|
||||
ptr_dest[i] = test_packet_buffer[i];;
|
||||
}
|
||||
// Tst PACKET
|
||||
UOTGHS->UOTGHS_DEVCTRL |= UOTGHS_DEVCTRL_TSTPCKT;
|
||||
// Send packet
|
||||
UOTGHS->UOTGHS_DEVEPTICR[2] = UOTGHS_DEVEPTICR_TXINIC;
|
||||
UOTGHS->UOTGHS_DEVEPTIDR[2] = UOTGHS_DEVEPTIDR_FIFOCONC;
|
||||
for(;;);
|
||||
// break;
|
||||
|
||||
case 1:
|
||||
//Test mode Test_J:
|
||||
//Upon command, a port's transceiver must enter the high-speed J state and remain in that
|
||||
//state until the exit action is taken. This enables the testing of the high output drive
|
||||
//level on the D+ line.
|
||||
// Send a ZLP
|
||||
USB_SendZlp();
|
||||
UOTGHS->UOTGHS_DEVCTRL |= UOTGHS_DEVCTRL_TSTJ;
|
||||
for(;;);
|
||||
// break;
|
||||
|
||||
case 2:
|
||||
//Test mode Test_K:
|
||||
//Upon command, a port's transceiver must enter the high-speed K state and remain in
|
||||
//that state until the exit action is taken. This enables the testing of the high output drive
|
||||
//level on the D- line.
|
||||
// Send a ZLP
|
||||
USB_SendZlp();
|
||||
UOTGHS->UOTGHS_DEVCTRL |= UOTGHS_DEVCTRL_TSTK;
|
||||
for(;;);
|
||||
// break;
|
||||
|
||||
case 3:
|
||||
//Test mode Test_SE0_NAK:
|
||||
//Upon command, a port's transceiver must enter the high-speed receive mode
|
||||
//and remain in that mode until the exit action is taken. This enables the testing
|
||||
//of output impedance, low level output voltage, and loading characteristics.
|
||||
//In addition, while in this mode, upstream facing ports (and only upstream facing ports)
|
||||
//must respond to any IN token packet with a NAK handshake (only if the packet CRC is
|
||||
//determined to be correct) within the normal allowed device response time. This enables testing of
|
||||
//the device squelch level circuitry and, additionally, provides a general purpose stimulus/response
|
||||
//test for basic functional testing.
|
||||
|
||||
// Send a ZLP
|
||||
USB_SendZlp();
|
||||
UOTGHS->UOTGHS_DEVIDR = UOTGHS_DEVIDR_SUSPEC
|
||||
| UOTGHS_DEVIDR_MSOFEC
|
||||
| UOTGHS_DEVIDR_SOFEC
|
||||
| UOTGHS_DEVIDR_EORSTEC
|
||||
| UOTGHS_DEVIDR_WAKEUPEC
|
||||
| UOTGHS_DEVIDR_EORSMEC
|
||||
| UOTGHS_DEVIDR_UPRSMEC
|
||||
| UOTGHS_DEVIDR_PEP_0
|
||||
| UOTGHS_DEVIDR_PEP_1
|
||||
| UOTGHS_DEVIDR_PEP_2
|
||||
| UOTGHS_DEVIDR_PEP_3
|
||||
| UOTGHS_DEVIDR_PEP_4
|
||||
| UOTGHS_DEVIDR_PEP_5
|
||||
| UOTGHS_DEVIDR_PEP_6
|
||||
| UOTGHS_DEVIDR_DMA_1
|
||||
| UOTGHS_DEVIDR_DMA_2
|
||||
| UOTGHS_DEVIDR_DMA_3
|
||||
| UOTGHS_DEVIDR_DMA_4
|
||||
| UOTGHS_DEVIDR_DMA_5
|
||||
| UOTGHS_DEVIDR_DMA_6;
|
||||
for(;;);
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//unsigned int iii=0;
|
||||
// Endpoint 0 interrupt
|
||||
static void USB_ISR(void)
|
||||
{
|
||||
// printf("ISR=0x%X\n\r", UOTGHS->UOTGHS_DEVISR); // jcb
|
||||
// if( iii++ > 1500 ) while(1); // jcb
|
||||
// End of bus reset
|
||||
if (Is_udd_reset())
|
||||
{
|
||||
TRACE_CORE(printf(">>> End of Reset\r\n");)
|
||||
|
||||
// Reset USB address to 0
|
||||
udd_configure_address(0);
|
||||
udd_enable_address();
|
||||
|
||||
// Configure EP 0
|
||||
UDD_InitEP(0, EP_TYPE_CONTROL);
|
||||
udd_enable_setup_received_interrupt(0);
|
||||
udd_enable_endpoint_interrupt(0);
|
||||
|
||||
_usbConfiguration = 0;
|
||||
udd_ack_reset();
|
||||
}
|
||||
|
||||
#ifdef CDC_ENABLED
|
||||
if (Is_udd_endpoint_interrupt(CDC_RX))
|
||||
{
|
||||
udd_ack_out_received(CDC_RX);
|
||||
|
||||
// Handle received bytes
|
||||
if (USBD_Available(CDC_RX))
|
||||
SerialUSB.accept();
|
||||
}
|
||||
|
||||
if (Is_udd_sof())
|
||||
{
|
||||
udd_ack_sof();
|
||||
// USBD_Flush(CDC_TX); // jcb
|
||||
}
|
||||
#endif
|
||||
|
||||
// EP 0 Interrupt
|
||||
if (Is_udd_endpoint_interrupt(0) )
|
||||
{
|
||||
if (!UDD_ReceivedSetupInt())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Setup setup;
|
||||
UDD_Recv(EP0, (uint8_t*)&setup, 8);
|
||||
UDD_ClearSetupInt();
|
||||
|
||||
uint8_t requestType = setup.bmRequestType;
|
||||
if (requestType & REQUEST_DEVICETOHOST)
|
||||
{
|
||||
TRACE_CORE(puts(">>> EP0 Int: IN Request\r\n");)
|
||||
UDD_WaitIN();
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_CORE(puts(">>> EP0 Int: OUT Request\r\n");)
|
||||
UDD_ClearIN();
|
||||
}
|
||||
|
||||
bool ok = true;
|
||||
if (REQUEST_STANDARD == (requestType & REQUEST_TYPE))
|
||||
{
|
||||
// Standard Requests
|
||||
uint8_t r = setup.bRequest;
|
||||
if (GET_STATUS == r)
|
||||
{
|
||||
if( setup.bmRequestType == 0 ) // device
|
||||
{
|
||||
// Send the device status
|
||||
TRACE_CORE(puts(">>> EP0 Int: GET_STATUS\r\n");)
|
||||
// Check current configuration for power mode (if device is configured)
|
||||
// TODO
|
||||
// Check if remote wake-up is enabled
|
||||
// TODO
|
||||
UDD_Send8(EP0, 0); // TODO
|
||||
UDD_Send8(EP0, 0);
|
||||
}
|
||||
// if( setup.bmRequestType == 2 ) // Endpoint:
|
||||
else
|
||||
{
|
||||
// Send the endpoint status
|
||||
// Check if the endpoint if currently halted
|
||||
if( isEndpointHalt == 1 )
|
||||
UDD_Send8(EP0, 1); // TODO
|
||||
else
|
||||
UDD_Send8(EP0, 0); // TODO
|
||||
UDD_Send8(EP0, 0);
|
||||
}
|
||||
}
|
||||
else if (CLEAR_FEATURE == r)
|
||||
{
|
||||
// Check which is the selected feature
|
||||
if( setup.wValueL == 1) // DEVICEREMOTEWAKEUP
|
||||
{
|
||||
// Enable remote wake-up and send a ZLP
|
||||
if( isRemoteWakeUpEnabled == 1 )
|
||||
UDD_Send8(EP0, 1);
|
||||
else
|
||||
UDD_Send8(EP0, 0);
|
||||
UDD_Send8(EP0, 0);
|
||||
}
|
||||
else // if( setup.wValueL == 0) // ENDPOINTHALT
|
||||
{
|
||||
isEndpointHalt = 0; // TODO
|
||||
UDD_Send8(EP0, 0);
|
||||
UDD_Send8(EP0, 0);
|
||||
}
|
||||
|
||||
}
|
||||
else if (SET_FEATURE == r)
|
||||
{
|
||||
// Check which is the selected feature
|
||||
if( setup.wValueL == 1) // DEVICEREMOTEWAKEUP
|
||||
{
|
||||
// Enable remote wake-up and send a ZLP
|
||||
isRemoteWakeUpEnabled = 1;
|
||||
UDD_Send8(EP0, 0);
|
||||
}
|
||||
if( setup.wValueL == 0) // ENDPOINTHALT
|
||||
{
|
||||
// Halt endpoint
|
||||
isEndpointHalt = 1;
|
||||
//USBD_Halt(USBGenericRequest_GetEndpointNumber(pRequest));
|
||||
UDD_Send8(EP0, 0);
|
||||
}
|
||||
if( setup.wValueL == 2) // TEST_MODE
|
||||
{
|
||||
// 7.1.20 Test Mode Support, 9.4.9 SetFeature
|
||||
if( (setup.bmRequestType == 0 /*USBGenericRequest_DEVICE*/) &&
|
||||
((setup.wIndex & 0x000F) == 0) )
|
||||
{
|
||||
// the lower byte of wIndex must be zero
|
||||
// the most significant byte of wIndex is used to specify the specific test mode
|
||||
|
||||
UOTGHS->UOTGHS_DEVIDR &= ~UOTGHS_DEVIDR_SUSPEC;
|
||||
UOTGHS->UOTGHS_DEVCTRL |= UOTGHS_DEVCTRL_SPDCONF_HIGH_SPEED; // remove suspend ?
|
||||
|
||||
Test_Mode_Support( (setup.wIndex & 0xFF00)>>8 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (SET_ADDRESS == r)
|
||||
{
|
||||
TRACE_CORE(puts(">>> EP0 Int: SET_ADDRESS\r\n");)
|
||||
UDD_WaitIN();
|
||||
UDD_SetAddress(setup.wValueL);
|
||||
}
|
||||
else if (GET_DESCRIPTOR == r)
|
||||
{
|
||||
TRACE_CORE(puts(">>> EP0 Int: GET_DESCRIPTOR\r\n");)
|
||||
ok = USBD_SendDescriptor(setup);
|
||||
}
|
||||
else if (SET_DESCRIPTOR == r)
|
||||
{
|
||||
TRACE_CORE(puts(">>> EP0 Int: SET_DESCRIPTOR\r\n");)
|
||||
ok = false;
|
||||
}
|
||||
else if (GET_CONFIGURATION == r)
|
||||
{
|
||||
TRACE_CORE(puts(">>> EP0 Int: GET_CONFIGURATION\r\n");)
|
||||
UDD_Send8(EP0, _usbConfiguration);
|
||||
}
|
||||
else if (SET_CONFIGURATION == r)
|
||||
{
|
||||
if (REQUEST_DEVICE == (requestType & REQUEST_RECIPIENT))
|
||||
{
|
||||
TRACE_CORE(printf(">>> EP0 Int: SET_CONFIGURATION REQUEST_DEVICE %d\r\n", setup.wValueL);)
|
||||
|
||||
UDD_InitEndpoints(EndPoints, (sizeof(EndPoints) / sizeof(EndPoints[0])));
|
||||
_usbConfiguration = setup.wValueL;
|
||||
|
||||
#ifdef CDC_ENABLED
|
||||
// Enable interrupt for CDC reception from host (OUT packet)
|
||||
udd_enable_out_received_interrupt(CDC_RX);
|
||||
udd_enable_endpoint_interrupt(CDC_RX);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_CORE(puts(">>> EP0 Int: SET_CONFIGURATION failed!\r\n");)
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
else if (GET_INTERFACE == r)
|
||||
{
|
||||
TRACE_CORE(puts(">>> EP0 Int: GET_INTERFACE\r\n");)
|
||||
UDD_Send8(EP0, _usbSetInterface);
|
||||
}
|
||||
else if (SET_INTERFACE == r)
|
||||
{
|
||||
_usbSetInterface = setup.wValueL;
|
||||
TRACE_CORE(puts(">>> EP0 Int: SET_INTERFACE\r\n");)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_CORE(puts(">>> EP0 Int: ClassInterfaceRequest\r\n");)
|
||||
|
||||
UDD_WaitIN(); // Workaround: need tempo here, else CDC serial won't open correctly
|
||||
|
||||
USBD_InitControl(setup.wLength); // Max length of transfer
|
||||
ok = USBD_ClassInterfaceRequest(setup);
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
TRACE_CORE(puts(">>> EP0 Int: Send packet\r\n");)
|
||||
UDD_ClearIN();
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_CORE(puts(">>> EP0 Int: Stall\r\n");)
|
||||
UDD_Stall();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void USBD_Flush(uint32_t ep)
|
||||
{
|
||||
if (UDD_FifoByteCount(ep))
|
||||
UDD_ReleaseTX(ep);
|
||||
}
|
||||
|
||||
// VBUS or counting frames
|
||||
// Any frame counting?
|
||||
uint32_t USBD_Connected(void)
|
||||
{
|
||||
uint8_t f = UDD_GetFrameNumber();
|
||||
|
||||
delay(3);
|
||||
|
||||
return f != UDD_GetFrameNumber();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//=======================================================================
|
||||
|
||||
USBDevice_ USBDevice;
|
||||
|
||||
USBDevice_::USBDevice_()
|
||||
{
|
||||
UDD_SetStack(&USB_ISR);
|
||||
|
||||
if (UDD_Init() == 0UL)
|
||||
{
|
||||
_usbInitialized=1UL;
|
||||
}
|
||||
}
|
||||
|
||||
bool USBDevice_::attach(void)
|
||||
{
|
||||
if (_usbInitialized != 0UL)
|
||||
{
|
||||
UDD_Attach();
|
||||
_usbConfiguration = 0;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool USBDevice_::detach(void)
|
||||
{
|
||||
if (_usbInitialized != 0UL)
|
||||
{
|
||||
UDD_Detach();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for interrupts
|
||||
// TODO: VBUS detection
|
||||
bool USBDevice_::configured()
|
||||
{
|
||||
return _usbConfiguration;
|
||||
}
|
||||
|
||||
void USBDevice_::poll()
|
||||
{
|
||||
}
|
|
@ -0,0 +1,496 @@
|
|||
/*
|
||||
Copyright (c) 2011 Arduino. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "variant.h"
|
||||
|
||||
/*
|
||||
* DUE Board pin | PORT | Label
|
||||
* ----------------+--------+-------
|
||||
* 0 | PA8 | "RX0"
|
||||
* 1 | PA9 | "TX0"
|
||||
* 2 TIOA0 | PB25 |
|
||||
* 3 TIOA7 | PC28 |
|
||||
* 4 NPCS1 | PA29 |
|
||||
* TIOB6 | PC26 |
|
||||
* 5 TIOA6 | PC25 |
|
||||
* 6 PWML7 | PC24 |
|
||||
* 7 PWML6 | PC23 |
|
||||
* 8 PWML5 | PC22 |
|
||||
* 9 PWML4 | PC21 |
|
||||
* 10 NPCS0 | PA28 |
|
||||
* TIOB7 | PC29 |
|
||||
* 11 TIOA8 | PD7 |
|
||||
* 12 TIOB8 | PD8 |
|
||||
* 13 TIOB0 | PB27 | LED AMBER "L"
|
||||
* 14 TXD3 | PD4 | "TX3"
|
||||
* 15 RXD3 | PD5 | "RX3"
|
||||
* 16 TXD1 | PA13 | "TX2"
|
||||
* 17 RXD1 | PA12 | "RX2"
|
||||
* 18 TXD0 | PA11 | "TX1"
|
||||
* 19 RXD0 | PA10 | "RX1"
|
||||
* 20 | PB12 | "SDA"
|
||||
* 21 | PB13 | "SCL"
|
||||
* 22 | PB26 |
|
||||
* 23 | PA14 |
|
||||
* 24 | PA15 |
|
||||
* 25 | PD0 |
|
||||
* 26 | PD1 |
|
||||
* 27 | PD2 |
|
||||
* 28 | PD3 |
|
||||
* 29 | PD6 |
|
||||
* 30 | PD9 |
|
||||
* 31 | PA7 |
|
||||
* 32 | PD10 |
|
||||
* 33 | PC1 |
|
||||
* 34 | PC2 |
|
||||
* 35 | PC3 |
|
||||
* 36 | PC4 |
|
||||
* 37 | PC5 |
|
||||
* 38 | PC6 |
|
||||
* 39 | PC7 |
|
||||
* 40 | PC8 |
|
||||
* 41 | PC9 |
|
||||
* 42 | PA19 |
|
||||
* 43 | PA20 |
|
||||
* 44 | PC19 |
|
||||
* 45 | PC18 |
|
||||
* 46 | PC17 |
|
||||
* 47 | PC16 |
|
||||
* 48 | PC15 |
|
||||
* 49 | PC14 |
|
||||
* 50 | PC13 |
|
||||
* 51 | PC12 |
|
||||
* 52 NPCS2 | PB21 |
|
||||
* 53 | PB14 |
|
||||
* 54 | PA16 | "A0"
|
||||
* 55 | PA24 | "A1"
|
||||
* 56 | PA23 | "A2"
|
||||
* 57 | PA22 | "A3"
|
||||
* 58 TIOB2 | PA6 | "A4"
|
||||
* 69 | PA4 | "A5"
|
||||
* 60 TIOB1 | PA3 | "A6"
|
||||
* 61 TIOA1 | PA2 | "A7"
|
||||
* 62 | PB17 | "A8"
|
||||
* 63 | PB18 | "A9"
|
||||
* 64 | PB19 | "A10"
|
||||
* 65 | PB20 | "A11"
|
||||
* 66 | PB15 | "DAC0"
|
||||
* 67 | PB16 | "DAC1"
|
||||
* 68 | PA1 | "CANRX"
|
||||
* 69 | PA0 | "CANTX"
|
||||
* 70 | PA17 | "SDA1"
|
||||
* 71 | PA18 | "SCL1"
|
||||
* 72 | PC30 | LED AMBER "RX"
|
||||
* 73 | PA21 | LED AMBER "TX"
|
||||
* 74 MISO | PA25 |
|
||||
* 75 MOSI | PA26 |
|
||||
* 76 SCLK | PA27 |
|
||||
* 77 NPCS0 | PA28 |
|
||||
* 78 NPCS3 | PB23 | unconnected!
|
||||
*
|
||||
* USB pin | PORT
|
||||
* ----------------+--------
|
||||
* ID | PB11
|
||||
* VBOF | PB10
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Pins descriptions
|
||||
*/
|
||||
extern const PinDescription g_APinDescription[]=
|
||||
{
|
||||
// 0 .. 53 - Digital pins
|
||||
// ----------------------
|
||||
// 0/1 - UART (Serial)
|
||||
{ PIOA, PIO_PA8A_URXD, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // URXD
|
||||
{ PIOA, PIO_PA9A_UTXD, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // UTXD
|
||||
|
||||
// 2
|
||||
{ PIOB, PIO_PB25B_TIOA0, ID_PIOB, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC0_CHA0 }, // TIOA0
|
||||
{ PIOC, PIO_PC28B_TIOA7, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHA7 }, // TIOA7
|
||||
{ PIOC, PIO_PC26B_TIOB6, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHB6 }, // TIOB6
|
||||
|
||||
// 5
|
||||
{ PIOC, PIO_PC25B_TIOA6, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHA6 }, // TIOA6
|
||||
{ PIOC, PIO_PC24B_PWML7, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), NO_ADC, NO_ADC, PWM_CH7, NOT_ON_TIMER }, // PWML7
|
||||
{ PIOC, PIO_PC23B_PWML6, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), NO_ADC, NO_ADC, PWM_CH6, NOT_ON_TIMER }, // PWML6
|
||||
{ PIOC, PIO_PC22B_PWML5, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), NO_ADC, NO_ADC, PWM_CH5, NOT_ON_TIMER }, // PWML5
|
||||
{ PIOC, PIO_PC21B_PWML4, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), NO_ADC, NO_ADC, PWM_CH4, NOT_ON_TIMER }, // PWML4
|
||||
// 10
|
||||
{ PIOC, PIO_PC29B_TIOB7, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHB7 }, // TIOB7
|
||||
{ PIOD, PIO_PD7B_TIOA8, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHA8 }, // TIOA8
|
||||
{ PIOD, PIO_PD8B_TIOB8, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC2_CHB8 }, // TIOB8
|
||||
|
||||
// 13 - AMBER LED
|
||||
{ PIOB, PIO_PB27B_TIOB0, ID_PIOB, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER), NO_ADC, NO_ADC, NOT_ON_PWM, TC0_CHB0 }, // TIOB0
|
||||
|
||||
// 14/15 - USART3 (Serial3)
|
||||
{ PIOD, PIO_PD4B_TXD3, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TXD3
|
||||
{ PIOD, PIO_PD5B_RXD3, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // RXD3
|
||||
|
||||
// 16/17 - USART1 (Serial2)
|
||||
{ PIOA, PIO_PA13A_TXD1, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TXD1
|
||||
{ PIOA, PIO_PA12A_RXD1, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // RXD1
|
||||
|
||||
// 18/19 - USART0 (Serial1)
|
||||
{ PIOA, PIO_PA11A_TXD0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TXD0
|
||||
{ PIOA, PIO_PA10A_RXD0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // RXD0
|
||||
|
||||
// 20/21 - TWI1
|
||||
{ PIOB, PIO_PB12A_TWD1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TWD1 - SDA0
|
||||
{ PIOB, PIO_PB13A_TWCK1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TWCK1 - SCL0
|
||||
|
||||
// 22
|
||||
{ PIOB, PIO_PB26, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 22
|
||||
{ PIOA, PIO_PA14, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 23
|
||||
{ PIOA, PIO_PA15, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 24
|
||||
{ PIOD, PIO_PD0, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 25
|
||||
|
||||
// 26
|
||||
{ PIOD, PIO_PD1, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 26
|
||||
{ PIOD, PIO_PD2, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 27
|
||||
{ PIOD, PIO_PD3, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 28
|
||||
{ PIOD, PIO_PD6, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 29
|
||||
|
||||
// 30
|
||||
{ PIOD, PIO_PD9, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 30
|
||||
{ PIOA, PIO_PA7, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 31
|
||||
{ PIOD, PIO_PD10, ID_PIOD, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 32
|
||||
{ PIOC, PIO_PC1, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 33
|
||||
|
||||
// 34
|
||||
{ PIOC, PIO_PC2, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 34
|
||||
{ PIOC, PIO_PC3, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 35
|
||||
{ PIOC, PIO_PC4, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 36
|
||||
{ PIOC, PIO_PC5, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 37
|
||||
|
||||
// 38
|
||||
{ PIOC, PIO_PC6, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 38
|
||||
{ PIOC, PIO_PC7, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 39
|
||||
{ PIOC, PIO_PC8, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 40
|
||||
{ PIOC, PIO_PC9, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 41
|
||||
|
||||
// 42
|
||||
{ PIOA, PIO_PA19, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 42
|
||||
{ PIOA, PIO_PA20, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 43
|
||||
{ PIOC, PIO_PC19, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 44
|
||||
{ PIOC, PIO_PC18, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 45
|
||||
|
||||
// 46
|
||||
{ PIOC, PIO_PC17, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 46
|
||||
{ PIOC, PIO_PC16, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 47
|
||||
{ PIOC, PIO_PC15, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 48
|
||||
{ PIOC, PIO_PC14, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 49
|
||||
|
||||
// 50
|
||||
{ PIOC, PIO_PC13, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 50
|
||||
{ PIOC, PIO_PC12, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 51
|
||||
{ PIOB, PIO_PB21, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 52
|
||||
{ PIOB, PIO_PB14, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 53
|
||||
|
||||
|
||||
// 54 .. 65 - Analog pins
|
||||
// ----------------------
|
||||
{ PIOA, PIO_PA16X1_AD7, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC7, NOT_ON_PWM, NOT_ON_TIMER }, // AD0
|
||||
{ PIOA, PIO_PA24X1_AD6, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC1, ADC6, NOT_ON_PWM, NOT_ON_TIMER }, // AD1
|
||||
{ PIOA, PIO_PA23X1_AD5, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC2, ADC5, NOT_ON_PWM, NOT_ON_TIMER }, // AD2
|
||||
{ PIOA, PIO_PA22X1_AD4, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC3, ADC4, NOT_ON_PWM, NOT_ON_TIMER }, // AD3
|
||||
// 58
|
||||
{ PIOA, PIO_PA6X1_AD3, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC4, ADC3, NOT_ON_PWM, TC0_CHB2 }, // AD4
|
||||
{ PIOA, PIO_PA4X1_AD2, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC5, ADC2, NOT_ON_PWM, NOT_ON_TIMER }, // AD5
|
||||
{ PIOA, PIO_PA3X1_AD1, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC6, ADC1, NOT_ON_PWM, TC0_CHB1 }, // AD6
|
||||
{ PIOA, PIO_PA2X1_AD0, ID_PIOA, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC7, ADC0, NOT_ON_PWM, TC0_CHA1 }, // AD7
|
||||
// 62
|
||||
{ PIOB, PIO_PB17X1_AD10, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC8, ADC10, NOT_ON_PWM, NOT_ON_TIMER }, // AD8
|
||||
{ PIOB, PIO_PB18X1_AD11, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC9, ADC11, NOT_ON_PWM, NOT_ON_TIMER }, // AD9
|
||||
{ PIOB, PIO_PB19X1_AD12, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC10, ADC12, NOT_ON_PWM, NOT_ON_TIMER }, // AD10
|
||||
{ PIOB, PIO_PB20X1_AD13, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC11, ADC13, NOT_ON_PWM, NOT_ON_TIMER }, // AD11
|
||||
|
||||
// 66/67 - DAC0/DAC1
|
||||
{ PIOB, PIO_PB15X1_DAC0, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC12, DA0, NOT_ON_PWM, NOT_ON_TIMER }, // DAC0
|
||||
{ PIOB, PIO_PB16X1_DAC1, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC13, DA1, NOT_ON_PWM, NOT_ON_TIMER }, // DAC1
|
||||
|
||||
// 68/69 - CANRX0/CANTX0
|
||||
{ PIOA, PIO_PA1A_CANRX0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, ADC14, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // CANRX
|
||||
{ PIOA, PIO_PA0A_CANTX0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, ADC15, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // CANTX
|
||||
|
||||
// 70/71 - TWI0
|
||||
{ PIOA, PIO_PA17A_TWD0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TWD0 - SDA1
|
||||
{ PIOA, PIO_PA18A_TWCK0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // TWCK0 - SCL1
|
||||
|
||||
// 72/73 - LEDs
|
||||
{ PIOC, PIO_PC30, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // LED AMBER RXL
|
||||
{ PIOA, PIO_PA21, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // LED AMBER TXL
|
||||
|
||||
// 74/75/76 - SPI
|
||||
{ PIOA, PIO_PA25A_SPI0_MISO,ID_PIOA,PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // MISO
|
||||
{ PIOA, PIO_PA26A_SPI0_MOSI,ID_PIOA,PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // MOSI
|
||||
{ PIOA, PIO_PA27A_SPI0_SPCK,ID_PIOA,PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // SPCK
|
||||
|
||||
// 77 - SPI CS0
|
||||
{ PIOA, PIO_PA28A_SPI0_NPCS0,ID_PIOA,PIO_PERIPH_A,PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS0
|
||||
|
||||
// 78 - SPI CS3 (unconnected)
|
||||
{ PIOB, PIO_PB23B_SPI0_NPCS3,ID_PIOB,PIO_PERIPH_B,PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS3
|
||||
|
||||
// 79 .. 84 - "All pins" masks
|
||||
|
||||
// 79 - TWI0 all pins
|
||||
{ PIOA, PIO_PA17A_TWD0|PIO_PA18A_TWCK0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
// 80 - TWI1 all pins
|
||||
{ PIOB, PIO_PB12A_TWD1|PIO_PB13A_TWCK1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
// 81 - UART (Serial) all pins
|
||||
{ PIOA, PIO_PA8A_URXD|PIO_PA9A_UTXD, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
// 82 - USART0 (Serial1) all pins
|
||||
{ PIOA, PIO_PA11A_TXD0|PIO_PA10A_RXD0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
// 83 - USART1 (Serial2) all pins
|
||||
{ PIOA, PIO_PA13A_TXD1|PIO_PA12A_RXD1, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
// 84 - USART3 (Serial3) all pins
|
||||
{ PIOD, PIO_PD4B_TXD3|PIO_PD5B_RXD3, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
|
||||
// 85 - USB
|
||||
{ PIOB, PIO_PB11A_UOTGID, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL,NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ID
|
||||
// { PIOB, PIO_PB11A_UOTGID|PIO_PB10A_UOTGVBOF, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL,NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ID - VBOF
|
||||
// 86 - SPI CS2
|
||||
{ PIOB, PIO_PB21B_SPI0_NPCS2, ID_PIOB, PIO_PERIPH_B, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS2
|
||||
|
||||
// 87 - SPI CS1
|
||||
{ PIOA, PIO_PA29A_SPI0_NPCS1, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // NPCS1
|
||||
|
||||
// 88/89 - CANRX1/CANTX1 (same physical pin for 66/53)
|
||||
{ PIOB, PIO_PB15A_CANRX1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // CANRX1
|
||||
{ PIOB, PIO_PB14A_CANTX1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // CANTX1
|
||||
|
||||
// 90 .. 91 - "All CAN pins" masks
|
||||
// 90 - CAN0 all pins
|
||||
{ PIOA, PIO_PA1A_CANRX0|PIO_PA0A_CANTX0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
// 91 - CAN1 all pins
|
||||
{ PIOB, PIO_PB15A_CANRX1|PIO_PB14A_CANTX1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_COMBO), NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
|
||||
// 92 .. 99 placeholders, future-proofing.
|
||||
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER },
|
||||
// 100 - 108 extra SAM3X8E pins, not wired on Due
|
||||
{ PIOA, PIO_PA5, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 100
|
||||
{ PIOC, PIO_PC27, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 101
|
||||
{ PIOA, PIO_PA0, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 102
|
||||
{ PIOA, PIO_PA1, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 103
|
||||
{ PIOC, PIO_PC11, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 104
|
||||
{ PIOC, PIO_PC8B_PWML3, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), NO_ADC, NO_ADC, PWM_CH3, NOT_ON_TIMER }, // PWM 105
|
||||
{ PIOC, PIO_PC2B_PWML0, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), NO_ADC, NO_ADC, PWM_CH0, NOT_ON_TIMER }, // PWM 106
|
||||
{ PIOC, PIO_PC6B_PWML2, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM), NO_ADC, NO_ADC, PWM_CH2, NOT_ON_TIMER }, //PWM 107
|
||||
{ PIOC, PIO_PC20, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, //PWM 108
|
||||
// 109 .. 114
|
||||
{ PIOA, PIO_PA20A_MCCDA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN_HSMCI_MCCDA_GPIO 109
|
||||
{ PIOA, PIO_PA19A_MCCK, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN_HSMCI_MCCK_GPIO 110
|
||||
{ PIOA, PIO_PA21A_MCDA0, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN_HSMCI_MCDA0_GPIO 111
|
||||
{ PIOA, PIO_PA22A_MCDA1, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN_HSMCI_MCDA1_GPIO 112
|
||||
{ PIOA, PIO_PA23A_MCDA2, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN_HSMCI_MCDA2_GPIO 113
|
||||
{ PIOA, PIO_PA24A_MCDA3, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN_HSMCI_MCDA3_GPIO 114
|
||||
// 115 .. 124 - ETHERNET MAC
|
||||
{ PIOB, PIO_PB0A_ETXCK, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ETXCK 115
|
||||
{ PIOB, PIO_PB1A_ETXEN, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ETXEN 116
|
||||
{ PIOB, PIO_PB2A_ETX0, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ETX0 117
|
||||
{ PIOB, PIO_PB3A_ETX1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ETX1 118
|
||||
{ PIOB, PIO_PB4A_ECRSDV, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ECRSDV 119
|
||||
{ PIOB, PIO_PB5A_ERX0, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ERX0 120
|
||||
{ PIOB, PIO_PB6A_ERX1, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ERX1 121
|
||||
{ PIOB, PIO_PB7A_ERXER, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ERXER 122
|
||||
{ PIOB, PIO_PB8A_EMDC, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // EMDC 123
|
||||
{ PIOB, PIO_PB9A_EMDIO, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // EMDIO 124
|
||||
// 125
|
||||
{ PIOB, PIO_PB24, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 125
|
||||
{ PIOB, PIO_PB21X1_AD14, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC14, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 126 - PB21 with enabled ADC
|
||||
{ PIOB, PIO_PB13X1_AD9, ID_PIOB, PIO_INPUT, PIO_DEFAULT, PIN_ATTR_ANALOG, ADC0, ADC9, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 127 - PB13 with enabled ACD AD9
|
||||
{ PIOB, PIO_PB22, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT, PIN_ATTR_DIGITAL, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // PIN 128 - PB22 E1 Enabled
|
||||
{ PIOB, PIO_PB10A_UOTGVBOF, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT, PIN_ATTR_DIGITAL,NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }, // ID - VBOF 129
|
||||
|
||||
// END
|
||||
{ NULL, 0, 0, PIO_NOT_A_PIN, PIO_DEFAULT, 0, NO_ADC, NO_ADC, NOT_ON_PWM, NOT_ON_TIMER }
|
||||
} ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* UART objects
|
||||
*/
|
||||
RingBuffer rx_buffer1;
|
||||
RingBuffer tx_buffer1;
|
||||
|
||||
UARTClass Serial(UART, UART_IRQn, ID_UART, &rx_buffer1, &tx_buffer1);
|
||||
void serialEvent() __attribute__((weak));
|
||||
void serialEvent() { }
|
||||
|
||||
// IT handlers
|
||||
void UART_Handler(void)
|
||||
{
|
||||
Serial.IrqHandler();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/*
|
||||
* USART objects
|
||||
*/
|
||||
RingBuffer rx_buffer2;
|
||||
RingBuffer rx_buffer3;
|
||||
RingBuffer rx_buffer4;
|
||||
RingBuffer tx_buffer2;
|
||||
RingBuffer tx_buffer3;
|
||||
RingBuffer tx_buffer4;
|
||||
|
||||
USARTClass Serial1(USART0, USART0_IRQn, ID_USART0, &rx_buffer2, &tx_buffer2);
|
||||
void serialEvent1() __attribute__((weak));
|
||||
void serialEvent1() { }
|
||||
USARTClass Serial2(USART1, USART1_IRQn, ID_USART1, &rx_buffer3, &tx_buffer3);
|
||||
void serialEvent2() __attribute__((weak));
|
||||
void serialEvent2() { }
|
||||
USARTClass Serial3(USART3, USART3_IRQn, ID_USART3, &rx_buffer4, &tx_buffer4);
|
||||
void serialEvent3() __attribute__((weak));
|
||||
void serialEvent3() { }
|
||||
|
||||
// IT handlers
|
||||
void USART0_Handler(void)
|
||||
{
|
||||
Serial1.IrqHandler();
|
||||
}
|
||||
|
||||
void USART1_Handler(void)
|
||||
{
|
||||
Serial2.IrqHandler();
|
||||
}
|
||||
|
||||
void USART3_Handler(void)
|
||||
{
|
||||
Serial3.IrqHandler();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void serialEventRun(void)
|
||||
{
|
||||
if (Serial.available()) serialEvent();
|
||||
if (Serial1.available()) serialEvent1();
|
||||
if (Serial2.available()) serialEvent2();
|
||||
if (Serial3.available()) serialEvent3();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void __libc_init_array(void);
|
||||
|
||||
void init( void )
|
||||
{
|
||||
SystemInit();
|
||||
|
||||
// Set Systick to 1ms interval, common to all SAM3 variants
|
||||
if (SysTick_Config(SystemCoreClock / 1000))
|
||||
{
|
||||
// Capture error
|
||||
while (true);
|
||||
}
|
||||
|
||||
// Disable watchdog
|
||||
//WDT_Disable(WDT);
|
||||
// Initialize C library
|
||||
__libc_init_array();
|
||||
|
||||
// Disable pull-up on every pin
|
||||
for (unsigned i = 0; i < PINS_COUNT; i++)
|
||||
digitalWrite(i, LOW);
|
||||
|
||||
// Enable parallel access on PIO output data registers
|
||||
PIOA->PIO_OWER = 0xFFFFFFFF;
|
||||
PIOB->PIO_OWER = 0xFFFFFFFF;
|
||||
PIOC->PIO_OWER = 0xFFFFFFFF;
|
||||
PIOD->PIO_OWER = 0xFFFFFFFF;
|
||||
|
||||
// Initialize Serial port U(S)ART pins
|
||||
PIO_Configure(
|
||||
g_APinDescription[PINS_UART].pPort,
|
||||
g_APinDescription[PINS_UART].ulPinType,
|
||||
g_APinDescription[PINS_UART].ulPin,
|
||||
g_APinDescription[PINS_UART].ulPinConfiguration);
|
||||
digitalWrite(0, HIGH); // Enable pullup for RX0
|
||||
PIO_Configure(
|
||||
g_APinDescription[PINS_USART0].pPort,
|
||||
g_APinDescription[PINS_USART0].ulPinType,
|
||||
g_APinDescription[PINS_USART0].ulPin,
|
||||
g_APinDescription[PINS_USART0].ulPinConfiguration);
|
||||
PIO_Configure(
|
||||
g_APinDescription[PINS_USART1].pPort,
|
||||
g_APinDescription[PINS_USART1].ulPinType,
|
||||
g_APinDescription[PINS_USART1].ulPin,
|
||||
g_APinDescription[PINS_USART1].ulPinConfiguration);
|
||||
PIO_Configure(
|
||||
g_APinDescription[PINS_USART3].pPort,
|
||||
g_APinDescription[PINS_USART3].ulPinType,
|
||||
g_APinDescription[PINS_USART3].ulPin,
|
||||
g_APinDescription[PINS_USART3].ulPinConfiguration);
|
||||
|
||||
// Initialize USB pins
|
||||
PIO_Configure(
|
||||
g_APinDescription[PINS_USB].pPort,
|
||||
g_APinDescription[PINS_USB].ulPinType,
|
||||
g_APinDescription[PINS_USB].ulPin,
|
||||
g_APinDescription[PINS_USB].ulPinConfiguration);
|
||||
|
||||
// Initialize CAN pins
|
||||
PIO_Configure(
|
||||
g_APinDescription[PINS_CAN0].pPort,
|
||||
g_APinDescription[PINS_CAN0].ulPinType,
|
||||
g_APinDescription[PINS_CAN0].ulPin,
|
||||
g_APinDescription[PINS_CAN0].ulPinConfiguration);
|
||||
PIO_Configure(
|
||||
g_APinDescription[PINS_CAN1].pPort,
|
||||
g_APinDescription[PINS_CAN1].ulPinType,
|
||||
g_APinDescription[PINS_CAN1].ulPin,
|
||||
g_APinDescription[PINS_CAN1].ulPinConfiguration);
|
||||
|
||||
// Initialize Analog Controller
|
||||
pmc_enable_periph_clk(ID_ADC);
|
||||
adc_init(ADC, SystemCoreClock, ADC_FREQ_MAX, ADC_STARTUP_FAST);
|
||||
adc_configure_timing(ADC, 0, ADC_SETTLING_TIME_3, 1);
|
||||
adc_configure_trigger(ADC, ADC_TRIG_SW, 0); // Disable hardware trigger.
|
||||
adc_disable_interrupt(ADC, 0xFFFFFFFF); // Disable all ADC interrupts.
|
||||
adc_disable_all_channel(ADC);
|
||||
|
||||
// Initialize analogOutput module
|
||||
analogOutputInit();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Plik diff jest za duży
Load Diff
|
@ -0,0 +1,461 @@
|
|||
/*
|
||||
This file is part of Repetier-Firmware.
|
||||
|
||||
Repetier-Firmware is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Repetier-Firmware is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Repetier-Firmware. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
/* ===================== IMPORTANT ========================
|
||||
|
||||
The LCD and Key support is new. I tested everything as good as possible,
|
||||
but some combinations may not work as supposed.
|
||||
The I2C methods rely on a stable I2C connection. Noise may cause wrong signals
|
||||
which can cause the firmware to freeze.
|
||||
|
||||
The ui adds quite some code, so AVRs with 64kB ram (Sanguino, Gen6) can not handle all features
|
||||
of the firmware at the same time. You have to disable some features to gain the
|
||||
ram needed. What should work:
|
||||
- No sd card - the sd card code is quite large.
|
||||
- No keys attached - The longest part is the menu handling.
|
||||
- EEPROM_MODE 0 .
|
||||
|
||||
Currently supported hardware:
|
||||
|
||||
*** Displays ***
|
||||
|
||||
- direct connected lcd with 4 data lines
|
||||
- connected via i2c
|
||||
|
||||
*** Keys ***
|
||||
|
||||
- rotary encoder
|
||||
- push button
|
||||
- key matrix up to 4x4
|
||||
- rotary encoder via i2c (only slow turns are captured correct)
|
||||
- push button via i2c
|
||||
|
||||
*** Buzzer ***
|
||||
|
||||
- directly connected, high = on
|
||||
- connected via i2c, low = on
|
||||
|
||||
==============================================================*/
|
||||
|
||||
#ifndef _ui_config_h
|
||||
#define _ui_config_h
|
||||
|
||||
//Davinci Specific, for cheat key
|
||||
#define FLAG_OK 1
|
||||
#define FLAG_NEXT 2
|
||||
#define FLAG_PREVIOUS 4
|
||||
#define FLAG_BACK 8
|
||||
#define FLAG_RIGHT 16
|
||||
#define FLAG_TOPMENU 32
|
||||
|
||||
/** While the ascii chars are all the same, the driver have different charsets
|
||||
for special chars used in different countries. The charset allows to fix for
|
||||
this problem. If characters look wrong, try a different charset. If nothing
|
||||
works, use the ascii charset 0 as fallback. Not the nicest for everything but working!
|
||||
|
||||
0 = ASCII fallback
|
||||
1 = Default works on most displays. This has some japanese chars in charset
|
||||
2 = Alternative charset with more european chars
|
||||
|
||||
*/
|
||||
//Davinci Specific, but not sure it is used
|
||||
#define UI_DISPLAY_CHARSET 1
|
||||
|
||||
/** Select type of beeper
|
||||
0 = none
|
||||
1 = Piezo connected to pin
|
||||
2 = Piezo connected to a pin over I2C
|
||||
*/
|
||||
#ifndef BEEPER_TYPE
|
||||
#define BEEPER_TYPE 1
|
||||
#define BEEPER_TYPE_INVERTING false
|
||||
#endif
|
||||
|
||||
#if BEEPER_TYPE==1 && !defined(BEEPER_PIN)
|
||||
//Davinci Specific, Buzzer pin
|
||||
#define BEEPER_PIN 41
|
||||
#endif
|
||||
#if BEEPER_TYPE==2
|
||||
#define BEEPER_ADDRESS 0x40 // I2C address of the chip with the beeper pin
|
||||
#define BEEPER_PIN _BV(7) // Bit value for pin 8
|
||||
#define COMPILE_I2C_DRIVER // We need the I2C driver as we are using i2c
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
What display type do you use?
|
||||
0 = No display
|
||||
1 = LCD Display with 4 bit data bus
|
||||
2 = LCD Display with 8 bit data bus (currently not implemented, fallback to 1)
|
||||
3 = LCD Display with I2C connection, 4 bit mode
|
||||
4 = Use the slower LiquiedCrystal library bundled with arduino.
|
||||
IMPORTANT: You need to uncomment the LiquidCrystal include in Repetier.pde for it to work.
|
||||
If you have Sanguino and want to use the library, you need to have Arduino 023 or older. (13.04.2012)
|
||||
5 = U8G supported display
|
||||
*/
|
||||
//Graphic LCD
|
||||
#define UI_DISPLAY_TYPE DISPLAY_U8G
|
||||
|
||||
#if UI_DISPLAY_TYPE == DISPLAY_U8G // Special case for graphic displays
|
||||
|
||||
#define U8GLIB_ST7920 // Currently only this display from u8g lib is included.
|
||||
#define UI_LCD_WIDTH 128
|
||||
#define UI_LCD_HEIGHT 64
|
||||
|
||||
//select font size
|
||||
#define UI_FONT_6X10 //default font
|
||||
#ifdef UI_FONT_6X10
|
||||
#define UI_FONT_WIDTH 6
|
||||
#define UI_FONT_HEIGHT 10
|
||||
#define UI_FONT_SMALL_HEIGHT 7
|
||||
#define UI_FONT_DEFAULT repetier_6x10
|
||||
#define UI_FONT_SMALL repetier_5x7
|
||||
#define UI_FONT_SMALL_WIDTH 5 //smaller font for status display
|
||||
#define UI_ANIMATION false // Animations are too slow
|
||||
#endif
|
||||
|
||||
//calculate rows and cols available with current font
|
||||
#define UI_COLS (UI_LCD_WIDTH/UI_FONT_WIDTH)
|
||||
#define UI_ROWS (UI_LCD_HEIGHT/UI_FONT_HEIGHT)
|
||||
#define UI_DISPLAY_CHARSET 3
|
||||
#else
|
||||
/** Number of columns per row
|
||||
Typical values are 16 and 20
|
||||
*/
|
||||
//Davinci Specific, screen has only 16 columns
|
||||
#define UI_COLS 16
|
||||
/**
|
||||
Rows of your display. 2 or 4
|
||||
*/
|
||||
#define UI_ROWS 4
|
||||
#endif // UI_DISPLAY_TYPE
|
||||
|
||||
/* What type of chip is used for I2C communication
|
||||
0 : PCF8574 or PCF8574A or compatible chips.
|
||||
1 : MCP23017
|
||||
*/
|
||||
#define UI_DISPLAY_I2C_CHIPTYPE 0
|
||||
// 0x40 till 0x4e for PCF8574, 0x40 for the adafruid RGB shield, 0x40 - 0x4e for MCP23017
|
||||
// Official addresses have a value half as high!
|
||||
#define UI_DISPLAY_I2C_ADDRESS 0x4e
|
||||
// For MCP 23017 define which pins should be output
|
||||
#define UI_DISPLAY_I2C_OUTPUT_PINS 65504
|
||||
// Set the output mask that is or'd over the output data. This is needed to activate
|
||||
// a backlight switched over the I2C.
|
||||
// The adafruit RGB shields enables a light if the bit is not set. Bits 6-8 are used for backlight.
|
||||
#define UI_DISPLAY_I2C_OUTPUT_START_MASK 0
|
||||
// For MCP which inputs are with pullup. 31 = pins 0-4 for adafruid rgb shield buttons
|
||||
#define UI_DISPLAY_I2C_PULLUP 31
|
||||
/* How fast should the I2C clock go. The PCF8574 work only with the lowest setting 100000.
|
||||
A MCP23017 can run also with 400000 Hz */
|
||||
#define UI_I2C_CLOCKSPEED 100000L
|
||||
/**
|
||||
Define the pin
|
||||
*/
|
||||
#if UI_DISPLAY_TYPE == DISPLAY_I2C // I2C Pin configuration
|
||||
#define UI_DISPLAY_RS_PIN _BV(4)
|
||||
#define UI_DISPLAY_RW_PIN _BV(5)
|
||||
#define UI_DISPLAY_ENABLE_PIN _BV(6)
|
||||
#define UI_DISPLAY_D0_PIN _BV(0)
|
||||
#define UI_DISPLAY_D1_PIN _BV(1)
|
||||
#define UI_DISPLAY_D2_PIN _BV(2)
|
||||
#define UI_DISPLAY_D3_PIN _BV(3)
|
||||
#define UI_DISPLAY_D4_PIN _BV(0)
|
||||
#define UI_DISPLAY_D5_PIN _BV(1)
|
||||
#define UI_DISPLAY_D6_PIN _BV(2)
|
||||
#define UI_DISPLAY_D7_PIN _BV(3)
|
||||
|
||||
// uncomment if your using led to indicated the bed is hot
|
||||
//#define UI_I2C_HEATBED_LED _BV(8)
|
||||
|
||||
// uncomment if your using led to indicated the extruder is hot
|
||||
//#define UI_I2C_HOTEND_LED _BV(7)
|
||||
|
||||
// uncomment if your using led to indicated the FAN is on
|
||||
//#define UI_I2C_FAN_LED _BV(6)
|
||||
|
||||
// Pins for adafruid RGB shield
|
||||
/*#define UI_DISPLAY_RS_PIN _BV(15)
|
||||
#define UI_DISPLAY_RW_PIN _BV(14)
|
||||
#define UI_DISPLAY_ENABLE_PIN _BV(13)
|
||||
#define UI_DISPLAY_D0_PIN _BV(12)
|
||||
#define UI_DISPLAY_D1_PIN _BV(11)
|
||||
#define UI_DISPLAY_D2_PIN _BV(10)
|
||||
#define UI_DISPLAY_D3_PIN _BV(9)
|
||||
#define UI_DISPLAY_D4_PIN _BV(12)
|
||||
#define UI_DISPLAY_D5_PIN _BV(11)
|
||||
#define UI_DISPLAY_D6_PIN _BV(10)
|
||||
#define UI_DISPLAY_D7_PIN _BV(9)*/
|
||||
|
||||
#else // Direct display connections
|
||||
//Davinci Specific, LCD and Back light pins
|
||||
#define UI_DISPLAY_RS_PIN 46
|
||||
#define UI_DISPLAY_RW_PIN -1
|
||||
#define UI_DISPLAY_RW_PIN_NOT_USED -1
|
||||
#define UI_DISPLAY_ENABLE_PIN 47
|
||||
#define UI_DISPLAY_D0_PIN -1
|
||||
#define UI_DISPLAY_D1_PIN -1
|
||||
#define UI_DISPLAY_D2_PIN -1
|
||||
#define UI_DISPLAY_D3_PIN -1
|
||||
#define UI_DISPLAY_D4_PIN 44
|
||||
#define UI_DISPLAY_D5_PIN -1
|
||||
#define UI_DISPLAY_D6_PIN -1
|
||||
#define UI_DISPLAY_D7_PIN -1
|
||||
#define UI_DELAYPERCHAR 320
|
||||
|
||||
//no back light so disable pin
|
||||
//#define UI_BACKLIGHT_PIN 78
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/** \brief Are some keys connected?
|
||||
|
||||
0 = No keys attached - disables also menu
|
||||
1 = Some keys attached
|
||||
*/
|
||||
//Davinci Specific, there is a key pad (6 keys: left, right,up, down, Ok, Menu)
|
||||
#define UI_HAS_KEYS 1
|
||||
|
||||
|
||||
/** \brief Is a back key present.
|
||||
|
||||
If you have menus enabled, you need a method to leave it. If you have a back key, you can always go one level higher.
|
||||
Without a back key, you need to navigate to the back entry in the menu. Setting this value to 1 removes the back entry.
|
||||
*/
|
||||
#define UI_HAS_BACK_KEY 0
|
||||
|
||||
/* Then you have the next/previous keys more like up/down keys, it may be more intuitive to change the direction you skip through the menus.
|
||||
If you set it to true, next will go to previous menu instead of the next menu.
|
||||
|
||||
*/
|
||||
#define UI_INVERT_MENU_DIRECTION 1
|
||||
|
||||
/** Uncomment this, if you have keys connected via i2c to a PCF8574 chip. */
|
||||
//#define UI_HAS_I2C_KEYS
|
||||
|
||||
// Do you have a I2C connected encoder?
|
||||
#define UI_HAS_I2C_ENCODER 0
|
||||
|
||||
// Under which address can the key status requested. This is the address of your PCF8574 where the keys are connected.
|
||||
// If you use a MCP23017 the address from display is used also for keys.
|
||||
#define UI_I2C_KEY_ADDRESS 0x40
|
||||
|
||||
|
||||
#ifdef UI_MAIN
|
||||
/* #######################################################################
|
||||
Key definitions
|
||||
|
||||
The firmware is very flexible regarding your input methods. You can use one
|
||||
or more of the predefined key macros, to define a mapper. If no matching mapper
|
||||
is available, you can add you c-code for mapping directly into the keyboard
|
||||
routines. The predefined macros do the same, just hiding the code behind it.
|
||||
|
||||
For each key, two seperate parts must be defined. The first is the initialization
|
||||
which must be added inside uiInitKeys() and the second ist a testing routine.
|
||||
These come into uiCheckKeys() or uiCheckSlowKeys() depending on the time needed
|
||||
for testing. If you are in doubt, put it in uiCheckSlowKeys().
|
||||
uiInitKeys() is called from an interrupt controlling the extruder, so only
|
||||
fast tests should be put there.
|
||||
The detect methods need an action identifier. A list of supported ids is found
|
||||
at the beginning of ui.h It's best to use the symbol name, in case the value changes.
|
||||
|
||||
1. Simple push button connected to gnd if closed on a free arduino pin
|
||||
init -> UI_KEYS_INIT_BUTTON_LOW(pinNumber);
|
||||
detect -> UI_KEYS_BUTTON_LOW(pinNumber,action);
|
||||
|
||||
2. Simple push button connected to 5v if closed on a free arduino pin
|
||||
init -> UI_KEYS_INIT_BUTTON_HIGH(pinNumber);
|
||||
detect -> UI_KEYS_BUTTON_HIGH(pinNumber,action);
|
||||
|
||||
3. Click encoder, A/B connected to gnd if closed.
|
||||
init -> UI_KEYS_INIT_CLICKENCODER_LOW(pinA,pinB);
|
||||
detect -> UI_KEYS_CLICKENCODER_LOW(pinA,pinB);
|
||||
or UI_KEYS_CLICKENCODER_LOW_REV(pinA,pinB); // reverse direction
|
||||
If you can move the menu cursor without a click, just be adding some force in one direction,
|
||||
toggle the _REV with non _REV and toggle pins.
|
||||
If the direction is wrong, toggle _REV with non _REV version.
|
||||
For the push button of the encoder use 1.
|
||||
|
||||
4. Click encoder, A/B connected to 5V if closed.
|
||||
init -> UI_KEYS_INIT_CLICKENCODER_HIGH(pinA,pinB);
|
||||
detect -> UI_KEYS_CLICKENCODER_HIGH(pinA,pinB);
|
||||
or UI_KEYS_CLICKENCODER_HIGH_REV(pinA,pinB); // reverse direction
|
||||
If you can move the menu cursor without a click, just be adding some force in one direction,
|
||||
toggle the _REV with non _REV and toggle pins.
|
||||
If the direction is wrong, toggle _REV with non _REV version.
|
||||
For the push button of the encoder use 2.
|
||||
|
||||
5. Maxtrix keyboard with 1-4 rows and 1-4 columns.
|
||||
init -> UI_KEYS_INIT_MATRIX(r1,r2,r3,r4,c1,c2,c3,c4);
|
||||
detect -> UI_KEYS_MATRIX(r1,r2,r3,r4,c1,c2,c3,c4);
|
||||
In addition you have to set UI_MATRIX_ACTIONS to match your desired actions.
|
||||
|
||||
------- Keys connected via I2C -------------
|
||||
|
||||
All keys and the buzzer if present must be on a connected to a single PCF8574 chip!
|
||||
As all I2C request take time, they belong all in uiCheckSlowKeys.
|
||||
Dont use the pin ids but instead _BV(pinNumber0_7) as pin id. 0 = First pin
|
||||
|
||||
6. Click encoder, A/B connected to gnd if closed.
|
||||
init -> not needed, but make sure UI_HAS_I2C_KEY is not commented out.
|
||||
detect -> UI_KEYS_I2C_CLICKENCODER_LOW(pinA,pinB);
|
||||
or UI_KEYS_I2C_CLICKENCODER_LOW_REV(pinA,pinB); // reverse direction
|
||||
If you can move the menu cursor without a click, just be adding some force in one direction,
|
||||
toggle the _REV with non _REV and toggle pins.
|
||||
If the direction is wrong, toggle _REV with non _REV version.
|
||||
For the push button of the encoder use 7.
|
||||
NOTICE: The polling frequency is limited, so only slow turns are captured correct!
|
||||
|
||||
7. Simple push button connected to gnd if closed via I2C on a PCF8574
|
||||
init -> not needed, but make sure UI_HAS_I2C_KEY is not commented out.
|
||||
detect -> UI_KEYS_I2C_BUTTON_LOW(pinNumber,action);
|
||||
|
||||
-------- Some notes on actions -------------
|
||||
|
||||
There are three kinds of actions.
|
||||
|
||||
Type 1: Immediate actions - these are execute and forget actions like home/pre-heat
|
||||
Type 2: Parameter change action - these change the mode for next/previous keys. They are valid
|
||||
until a new change action is initiated or the action is finished with ok button.
|
||||
Type 3: Show menu action. These actions have a _MENU_ in their name. If they are executed, a new
|
||||
menu is pushed on the menu stack and you see the menu. If you assign these actions directly
|
||||
to a key, you might not want this pushing behaviour. In this case add UI_ACTION_TOPMENU to the
|
||||
action, like UI_ACTION_TOPMENU+UI_ACTION_MENU_XPOSFAST. That will show the menu as top-menu
|
||||
closing all othe submenus that were open.
|
||||
|
||||
####################################################################### */
|
||||
|
||||
// Use these codes for key detect. The main menu will show the pressed action in the lcd display.
|
||||
// after that assign the desired codes.
|
||||
//#define UI_MATRIX_ACTIONS {2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015}
|
||||
// Define your matrix actions
|
||||
#define UI_MATRIX_ACTIONS {UI_ACTION_HOME_ALL, UI_ACTION_TOP_MENU, UI_ACTION_SET_ORIGIN, UI_ACTION_NEXT,\
|
||||
UI_ACTION_HOME_Z, UI_ACTION_MENU_ZPOS, UI_ACTION_COOLDOWN, UI_ACTION_OK,\
|
||||
UI_ACTION_HOME_Y, UI_ACTION_MENU_YPOSFAST, UI_ACTION_PREHEAT_ABS, UI_ACTION_PREVIOUS,\
|
||||
UI_ACTION_HOME_X, UI_ACTION_MENU_XPOSFAST, UI_ACTION_DISABLE_STEPPER, UI_ACTION_BACK}
|
||||
#ifdef UI_MATRIX_ACTIONS
|
||||
const int matrixActions[] PROGMEM = UI_MATRIX_ACTIONS;
|
||||
#endif
|
||||
|
||||
void uiInitKeys() {
|
||||
#if UI_HAS_KEYS!=0
|
||||
UI_KEYS_INIT_CLICKENCODER_LOW(52,50); // click encoder on pins 50 and 52. Phase is connected with gnd for signals.
|
||||
UI_KEYS_INIT_BUTTON_LOW(48); // push button, connects gnd to pin
|
||||
//UI_KEYS_INIT_BUTTON_LOW(10);
|
||||
//UI_KEYS_INIT_BUTTON_LOW(72);
|
||||
//UI_KEYS_INIT_BUTTON_LOW(75);
|
||||
// UI_KEYS_INIT_BUTTON_LOW(76);
|
||||
// UI_KEYS_INIT_BUTTON_LOW(77);
|
||||
|
||||
// UI_KEYS_INIT_CLICKENCODER_LOW(47,45); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
|
||||
// UI_KEYS_INIT_BUTTON_LOW(43); // push button, connects gnd to pin
|
||||
// UI_KEYS_INIT_MATRIX(32,47,45,43,41,39,37,35);
|
||||
#endif
|
||||
}
|
||||
void uiCheckKeys(int &action) {
|
||||
#if UI_HAS_KEYS!=0
|
||||
|
||||
//Davinci Specific, for cheat key
|
||||
//int key_flag=0;
|
||||
//UI_KEYS_CLICKENCODER_LOW_REV(33,31); // click encoder on pins 47 and 45. Phase is connected with gnd for signals.
|
||||
//Davinci Specific, key pad and cheat keys definition
|
||||
//UI_KEYS_BUTTON_LOW(76,UI_ACTION_OK); // push button, connects gnd to pin
|
||||
//if (action==UI_ACTION_OK)key_flag = key_flag|FLAG_OK;
|
||||
//UI_KEYS_BUTTON_LOW(10,UI_ACTION_NEXT); // push button, connects gnd to pin
|
||||
//if (action==UI_ACTION_NEXT)key_flag = key_flag|FLAG_NEXT;
|
||||
//UI_KEYS_BUTTON_LOW(44,UI_ACTION_PREVIOUS); // push button, connects gnd to pin
|
||||
//if (action==UI_ACTION_PREVIOUS)key_flag = key_flag|FLAG_PREVIOUS;
|
||||
//UI_KEYS_BUTTON_LOW(75,UI_ACTION_BACK); // push button, connects gnd to pin
|
||||
//if (action==UI_ACTION_BACK)key_flag = key_flag|FLAG_BACK;
|
||||
//UI_KEYS_BUTTON_LOW(72,UI_ACTION_RIGHT_KEY); // push button, connects gnd to pin
|
||||
//if (action==UI_ACTION_RIGHT_KEY)key_flag = key_flag|FLAG_RIGHT;
|
||||
//UI_KEYS_BUTTON_LOW(77,UI_ACTION_TOP_MENU); // push button, connects gnd to pin
|
||||
//if (action==UI_ACTION_TOP_MENU)key_flag = key_flag|FLAG_TOPMENU;
|
||||
//if (key_flag==(FLAG_OK|FLAG_PREVIOUS|FLAG_TOPMENU))action=UI_ACTION_OK_TOP_PREV;
|
||||
//if (key_flag==(FLAG_OK|FLAG_NEXT|FLAG_TOPMENU))action=UI_ACTION_OK_TOP_NEXT;
|
||||
//if (key_flag==(FLAG_OK|FLAG_NEXT|FLAG_TOPMENU))action=UI_ACTION_OK_TOP_BACK;
|
||||
//if (key_flag==(FLAG_OK|FLAG_RIGHT|FLAG_BACK))action=UI_ACTION_OK_TOP_RIGHT;
|
||||
//if (key_flag==(FLAG_OK|FLAG_NEXT|FLAG_BACK))action=UI_ACTION_OK_NEXT_BACK;
|
||||
//if (key_flag==(FLAG_OK|FLAG_NEXT|FLAG_PREVIOUS))action=UI_ACTION_OK_NEXT_PREV;
|
||||
//if (key_flag==(FLAG_OK|FLAG_NEXT|FLAG_RIGHT))action=UI_ACTION_OK_NEXT_RIGHT;
|
||||
//if (key_flag==(FLAG_OK|FLAG_PREVIOUS|FLAG_RIGHT))action=UI_ACTION_OK_PREV_RIGHT;
|
||||
//if (key_flag==(FLAG_OK|FLAG_PREVIOUS|FLAG_BACK))action=UI_ACTION_OK_PREV_BACK;
|
||||
|
||||
UI_KEYS_CLICKENCODER_LOW_REV(52,50); // click encoder on pins 50 and 52. Phase is connected with gnd for signals.
|
||||
UI_KEYS_BUTTON_LOW(48,UI_ACTION_OK); // push button, connects gnd to pin
|
||||
#endif
|
||||
}
|
||||
inline void uiCheckSlowEncoder() {
|
||||
#if defined(UI_HAS_I2C_KEYS) && UI_HAS_KEYS!=0
|
||||
#if UI_DISPLAY_I2C_CHIPTYPE==0
|
||||
HAL::i2cStartWait(UI_I2C_KEY_ADDRESS+I2C_READ);
|
||||
uint8_t keymask = HAL::i2cReadNak(); // Read current key mask
|
||||
#endif
|
||||
#if UI_DISPLAY_I2C_CHIPTYPE==1
|
||||
HAL::i2cStartWait(UI_DISPLAY_I2C_ADDRESS+I2C_WRITE);
|
||||
HAL::i2cWrite(0x12); // GIOA
|
||||
HAL::i2cStop();
|
||||
HAL::i2cStartWait(UI_DISPLAY_I2C_ADDRESS+I2C_READ);
|
||||
unsigned int keymask = HAL::i2cReadAck();
|
||||
keymask = keymask + (HAL::i2cReadNak()<<8);
|
||||
#endif
|
||||
HAL::i2cStop();
|
||||
// Add I2C click encoder tests here, all other i2c tests and a copy of the encoder test belog in uiCheckSlowKeys
|
||||
UI_KEYS_I2C_CLICKENCODER_LOW_REV(_BV(2),_BV(0)); // click encoder on pins 0 and 2. Phase is connected with gnd for signals.
|
||||
#endif
|
||||
}
|
||||
|
||||
void uiCheckSlowKeys(int &action) {
|
||||
#if defined(UI_HAS_I2C_KEYS) && UI_HAS_KEYS!=0
|
||||
#if UI_DISPLAY_I2C_CHIPTYPE==0
|
||||
HAL::i2cStartWait(UI_I2C_KEY_ADDRESS+I2C_READ);
|
||||
uint8_t keymask = HAL::i2cReadNak(); // Read current key mask
|
||||
#endif
|
||||
#if UI_DISPLAY_I2C_CHIPTYPE==1
|
||||
HAL::i2cStartWait(UI_DISPLAY_I2C_ADDRESS+I2C_WRITE);
|
||||
HAL::i2cWrite(0x12); // GPIOA
|
||||
HAL::i2cStop();
|
||||
HAL::i2cStartWait(UI_DISPLAY_I2C_ADDRESS+I2C_READ);
|
||||
unsigned int keymask = HAL::i2cReadAck();
|
||||
keymask = keymask + (HAL::i2cReadNak()<<8);
|
||||
#endif
|
||||
HAL::i2cStop();
|
||||
// Add I2C key tests here
|
||||
UI_KEYS_I2C_CLICKENCODER_LOW_REV(_BV(2),_BV(0)); // click encoder on pins 0 and 2. Phase is connected with gnd for signals.
|
||||
UI_KEYS_I2C_BUTTON_LOW(_BV(1),UI_ACTION_OK); // push button, connects gnd to pin
|
||||
UI_KEYS_I2C_BUTTON_LOW(_BV(3),UI_ACTION_BACK); // push button, connects gnd to pin
|
||||
UI_KEYS_I2C_BUTTON_LOW(_BV(4),UI_ACTION_MENU_QUICKSETTINGS+UI_ACTION_TOPMENU); // push button, connects gnd to pin
|
||||
UI_KEYS_I2C_BUTTON_LOW(_BV(5),UI_ACTION_MENU_EXTRUDER+UI_ACTION_TOPMENU); // push button, connects gnd to pin
|
||||
UI_KEYS_I2C_BUTTON_LOW(_BV(6),UI_ACTION_MENU_POSITIONS+UI_ACTION_TOPMENU); // push button, connects gnd to pin
|
||||
/*
|
||||
// Button handling for the Adafruit RGB shild
|
||||
UI_KEYS_I2C_BUTTON_LOW(4,UI_ACTION_PREVIOUS); // Up button
|
||||
UI_KEYS_I2C_BUTTON_LOW(8,UI_ACTION_NEXT); // down button
|
||||
UI_KEYS_I2C_BUTTON_LOW(16,UI_ACTION_BACK); // left button
|
||||
UI_KEYS_I2C_BUTTON_LOW(2,UI_ACTION_OK); // right button
|
||||
UI_KEYS_I2C_BUTTON_LOW(1,UI_ACTION_MENU_QUICKSETTINGS); //Select button
|
||||
// ----- End RGB shield ----------
|
||||
*/
|
||||
#endif
|
||||
|
||||
//UI_KEYS_MATRIX(32,47,45,43,41,39,37,35);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -155,7 +155,7 @@ void Commands::checkForPeriodicalActions(bool allowNewMoves)
|
|||
if (delay_flag_change>5)
|
||||
{
|
||||
Printer::setMenuMode(MENU_MODE_PRINTING,false);
|
||||
UI_STATUS_UPD(UI_TEXT_IDLE);
|
||||
// UI_STATUS_UPD(UI_TEXT_IDLE);
|
||||
delay_flag_change=0;
|
||||
}
|
||||
else delay_flag_change++;
|
||||
|
@ -1268,7 +1268,7 @@ void Commands::processMCode(GCode *com)
|
|||
else
|
||||
{
|
||||
pinMode(pin_number, INPUT_PULLUP);
|
||||
Com::printF(Com::tSpaceToSpace, pin_number);
|
||||
Com::printF(Com::tReadInput, pin_number);
|
||||
Com::printFLN(Com::tSpaceIsSpace, digitalRead(pin_number));
|
||||
}
|
||||
}
|
||||
|
@ -2061,6 +2061,12 @@ void Commands::executeGCode(GCode *com)
|
|||
TOGGLE(CASE_LIGHTS_PIN);
|
||||
}
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > 0
|
||||
if (!(READ(BADGE_LIGHT_PIN)) && EEPROM::busebadgelight && EEPROM::buselight)
|
||||
{
|
||||
TOGGLE(BADGE_LIGHT_PIN);
|
||||
}
|
||||
#endif
|
||||
#if defined(UI_BACKLIGHT_PIN)
|
||||
if (!(READ(UI_BACKLIGHT_PIN))) WRITE(UI_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
@ -2113,6 +2119,13 @@ Printer::setMenuModeEx(MENU_MODE_GCODE_PROCESSING,false);
|
|||
|
||||
void Commands::emergencyStop()
|
||||
{
|
||||
//Davinci Specific, EEPROM is on SD Card
|
||||
#if defined(SDEEPROM)
|
||||
if (!HAL::syncSdEeprom())
|
||||
{
|
||||
Com::printFLN(PSTR("SD EEPROM write error"));
|
||||
}
|
||||
#endif
|
||||
#if defined(KILL_METHOD) && KILL_METHOD == 1
|
||||
HAL::resetHardware();
|
||||
#else
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
|
||||
#include "Repetier.h"
|
||||
#include <string.h>
|
||||
|
||||
#if DRIVE_SYSTEM == DELTA
|
||||
FSTRINGVALUE(Com::tFirmware,"FIRMWARE_NAME:Repetier_" REPETIER_VERSION " FIRMWARE_URL:https://github.com/repetier/Repetier-Firmware/ PROTOCOL_VERSION:1.0 MACHINE_TYPE:Delta EXTRUDER_COUNT:" XSTR(NUM_EXTRUDER) " REPETIER_PROTOCOL:3")
|
||||
|
@ -32,16 +33,24 @@ FSTRINGVALUE(Com::tFirmware,"FIRMWARE_NAME:Repetier_" REPETIER_VERSION " FIRMWAR
|
|||
#endif
|
||||
#endif
|
||||
//Davinci Specific
|
||||
FSTRINGVALUE(Com::tReadInput,"Read input: ")
|
||||
FSTRINGVALUE(Com::tReset,RESET_IDENTIFIER)
|
||||
FSTRINGVALUE(Com::tTempExtABS,"Temp Ext ABS:")
|
||||
FSTRINGVALUE(Com::tTempExtPLA,"Temp Ext PLA:")
|
||||
FSTRINGVALUE(Com::tTempBedABS,"Temp Bed ABS:")
|
||||
FSTRINGVALUE(Com::tTempBedPLA,"Temp Bed PLA:")
|
||||
|
||||
FSTRINGVALUE(Com::tLoadFeedRate,"Load Feed Rate:")
|
||||
FSTRINGVALUE(Com::tUnloadFeedRate,"Unload Feed Rate:")
|
||||
FSTRINGVALUE(Com::tUnloadLoadDistance,"Unload/Load Distance:")
|
||||
|
||||
FSTRINGVALUE(Com::tKeepLightOn,"Keep Light On:")
|
||||
FSTRINGVALUE(Com::tSensorOn,"Filament Sensor On:")
|
||||
FSTRINGVALUE(Com::tTopsensorOn,"Top Sensor On:")
|
||||
FSTRINGVALUE(Com::tLightOn,"Light On:")
|
||||
FSTRINGVALUE(Com::tBadgeLightOn,"Badge On:")
|
||||
FSTRINGVALUE(Com::tSoundOn,"Sound On:")
|
||||
FSTRINGVALUE(Com::tWifiOn,"Wifi On:")
|
||||
FSTRINGVALUE(Com::tPowerSave,"Powersave after [ms,0=off]:")
|
||||
FSTRINGVALUE(Com::tDisplayMode,"Display Mode:")
|
||||
FSTRINGVALUE(Com::tDebug,"Debug:")
|
||||
|
@ -51,6 +60,7 @@ FSTRINGVALUE(Com::tNAN,"NAN")
|
|||
FSTRINGVALUE(Com::tINF,"INF")
|
||||
FSTRINGVALUE(Com::tError,"Error:")
|
||||
FSTRINGVALUE(Com::tInfo,"Info:")
|
||||
FSTRINGVALUE(Com::tStatus,"Status:")
|
||||
FSTRINGVALUE(Com::tWarning,"Warning:")
|
||||
FSTRINGVALUE(Com::tResend,"Resend:")
|
||||
FSTRINGVALUE(Com::tEcho,"Echo:")
|
||||
|
@ -575,7 +585,9 @@ void Com::printFloat(float number, uint8_t digits)
|
|||
printF(tINF);
|
||||
return;
|
||||
}
|
||||
// Handle negative numbers
|
||||
|
||||
print(String(number,digits).c_str());
|
||||
/*// Handle negative numbers
|
||||
if (number < 0.0)
|
||||
{
|
||||
print('-');
|
||||
|
@ -604,5 +616,5 @@ void Com::printFloat(float number, uint8_t digits)
|
|||
int toPrint = int(remainder);
|
||||
print(toPrint);
|
||||
remainder -= toPrint;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -26,16 +26,22 @@ class Com
|
|||
{
|
||||
public:
|
||||
//Davinci Specific
|
||||
FSTRINGVAR(tReadInput)
|
||||
FSTRINGVAR(tReset)
|
||||
FSTRINGVAR(tTempExtABS)
|
||||
FSTRINGVAR(tTempExtPLA)
|
||||
FSTRINGVAR(tTempBedABS)
|
||||
FSTRINGVAR(tTempBedPLA)
|
||||
FSTRINGVAR(tLoadFeedRate)
|
||||
FSTRINGVAR(tUnloadFeedRate)
|
||||
FSTRINGVAR(tUnloadLoadDistance)
|
||||
FSTRINGVAR(tKeepLightOn)
|
||||
FSTRINGVAR(tSensorOn)
|
||||
FSTRINGVAR(tTopsensorOn)
|
||||
FSTRINGVAR(tLightOn)
|
||||
FSTRINGVAR(tBadgeLightOn)
|
||||
FSTRINGVAR(tSoundOn)
|
||||
FSTRINGVAR(tWifiOn)
|
||||
FSTRINGVAR(tPowerSave)
|
||||
FSTRINGVAR(tDisplayMode)
|
||||
FSTRINGVAR(tDebug)
|
||||
|
@ -46,6 +52,7 @@ FSTRINGVAR(tNAN)
|
|||
FSTRINGVAR(tINF)
|
||||
FSTRINGVAR(tError)
|
||||
FSTRINGVAR(tInfo)
|
||||
FSTRINGVAR(tStatus)
|
||||
FSTRINGVAR(tWarning)
|
||||
FSTRINGVAR(tResend)
|
||||
FSTRINGVAR(tEcho)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
// ################## EDIT THESE SETTINGS MANUALLY ################
|
||||
|
||||
#define DAVINCI 1 // "1" For DAVINCI 1.0, "2" For DAVINCI 2.0 with 1 FAN, "3" For DAVINCI 2.0 with 2 FAN
|
||||
#define DAVINCI 1 // "0" if not DAVINCI, "1" For DAVINCI 1.0, "2" For DAVINCI 2.0 with 1 FAN, "3" For DAVINCI 2.0 with 2 FAN, 4 for AiO (WITH NO SCANNER SUPPORT)
|
||||
#define MODEL 0//"0" for first generation (jumper JP1 to reset ) , "1" for new generation (jumper J37 to reset)
|
||||
#define REPURPOSE_FAN_TO_COOL_EXTRUSIONS 0 //Setting this to 1 will repurpose the main Extruder cooling fan to be controlled VIA M106/M107
|
||||
//Warning: for DaVinci 1.0 need to add a permanent fan with power supply to cool extruder
|
||||
|
@ -31,8 +31,8 @@
|
|||
//Version
|
||||
#define VERSION_MAJOR "1"
|
||||
#define VERSION_MINOR_YEAR "15"
|
||||
#define VERSION_MINOR_MONTH "03"
|
||||
#define VERSION_MINOR_DAY "20"
|
||||
#define VERSION_MINOR_MONTH "10"
|
||||
#define VERSION_MINOR_DAY "30"
|
||||
#define VERSION_BUILD "1"
|
||||
|
||||
//Davinci screen is not standard reprap it is WINSTAR 16x4
|
||||
|
@ -47,20 +47,53 @@
|
|||
#define UI_AUTOLIGHTOFF_AFTER 1
|
||||
#define ENABLE_CLEAN_DRIPBOX 1
|
||||
#define ENABLE_CLEAN_NOZZLE 1
|
||||
#define FEATURE_ENCODER 0
|
||||
//ensure of some define if AiO
|
||||
#if DAVINCI==4
|
||||
//no drip box
|
||||
#undef ENABLE_CLEAN_DRIPBOX
|
||||
#define ENABLE_CLEAN_DRIPBOX 0
|
||||
//it must be model 1
|
||||
#undef MODEL
|
||||
#define MODEL 1
|
||||
#endif
|
||||
//to enable communication using wifi module set to 1
|
||||
#define ENABLE_WIFI 0
|
||||
//define the wifi serial output
|
||||
//on Davinci use Serial
|
||||
//on RADDS use Serial1
|
||||
#if ENABLE_WIFI
|
||||
#if DAVINCI == 0
|
||||
#define WIFI_SERIAL Serial1
|
||||
#else
|
||||
#define WIFI_SERIAL Serial
|
||||
#endif
|
||||
#endif
|
||||
//if wifi is enabled serial need to slow down a little, this is a delay in ms after a '\n' so normaly after a command or a message
|
||||
#define DELAY_BY_LINE 50
|
||||
#if ENABLE_CLEAN_NOZZLE
|
||||
#if DAVINCI==1 //cleaner of Davinci 1.0 is not in same position of 2.0
|
||||
#if DAVINCI==0
|
||||
#define CLEAN_X 20
|
||||
#define CLEAN_Y 20
|
||||
#endif
|
||||
#if DAVINCI>=2
|
||||
#if DAVINCI==1 //cleaner of Davinci 1.0 is not in same position of 2.0 neither AiO
|
||||
#define CLEAN_X 20
|
||||
#define CLEAN_Y 20
|
||||
#endif
|
||||
#if DAVINCI==2 || DAVINCI==3
|
||||
#define CLEAN_X 0
|
||||
#define CLEAN_Y 30
|
||||
#endif
|
||||
#if DAVINCI==4
|
||||
#define CLEAN_X 35
|
||||
#define CLEAN_Y 55
|
||||
#endif
|
||||
#endif
|
||||
#define CASE_KEEP_LIGHT_DEFAULT_ON 1
|
||||
#define CASE_FILAMENT_SENSOR_DEFAULT_ON 1
|
||||
#define CASE_TOP_SENSOR_DEFAULT_ON 1
|
||||
#define CASE_SOUND_DEFAULT_ON 1
|
||||
#define CASE_WIFI_DEFAULT_ON 0
|
||||
//default mode is advanced
|
||||
#define CASE_DISPLAY_MODE_DEFAULT 1
|
||||
|
||||
|
@ -91,9 +124,15 @@ To override EEPROM settings with config settings, set EEPROM_MODE 0
|
|||
// BASIC SETTINGS: select your board type, thermistor type, axis scaling, and endstop configuration
|
||||
|
||||
/** Number of extruders. Maximum 6 extruders. */
|
||||
#if DAVINCI==1
|
||||
#if DAVINCI==0
|
||||
#define NUM_EXTRUDER 1
|
||||
#else
|
||||
#endif
|
||||
//1.0/1.0A/AiO have 1 extruder
|
||||
#if DAVINCI==1 || DAVINCI==4
|
||||
#define NUM_EXTRUDER 1
|
||||
#endif
|
||||
//2.0/2.0A have 2 extruders
|
||||
#if DAVINCI==2 || DAVINCI==3
|
||||
#define NUM_EXTRUDER 2
|
||||
#endif
|
||||
|
||||
|
@ -108,7 +147,11 @@ setpe per mm and heater manager settings in extruder 0 are used! */
|
|||
// Arduino Due with RAMPS-FD V2 = 404
|
||||
//specific board is 999 = DaVinci
|
||||
|
||||
#if DAVINCI==0
|
||||
#define MOTHERBOARD 402
|
||||
#else
|
||||
#define MOTHERBOARD 999
|
||||
#endif
|
||||
|
||||
#include "pins.h"
|
||||
|
||||
|
@ -264,9 +307,13 @@ Overridden if EEPROM activated.*/
|
|||
#define EXT0_STEP_PIN E0_STEP_PIN
|
||||
#define EXT0_DIR_PIN E0_DIR_PIN
|
||||
// set to false/true for normal / inverse direction
|
||||
#if DAVINCI==1
|
||||
#if DAVINCI==0
|
||||
#define EXT0_INVERSE false
|
||||
#else
|
||||
#endif
|
||||
#if DAVINCI==1 || DAVINCI==4
|
||||
#define EXT0_INVERSE false
|
||||
#endif
|
||||
#if DAVINCI==2 || DAVINCI==3
|
||||
#define EXT0_INVERSE true
|
||||
#endif
|
||||
#define EXT0_ENABLE_PIN E0_ENABLE_PIN
|
||||
|
@ -461,7 +508,10 @@ cog. Direct drive extruder need 0. */
|
|||
#define EXT1_SELECT_COMMANDS "M117 Extruder 2"
|
||||
#define EXT1_DESELECT_COMMANDS ""
|
||||
/** The extruder cooler is a fan to cool the extruder when it is heating. If you turn the etxruder on, the fan goes on. */
|
||||
#if DAVINCI==1
|
||||
#if DAVINCI==0
|
||||
#define EXT1_EXTRUDER_COOLER_PIN ORIG_FAN_PIN
|
||||
#endif
|
||||
#if DAVINCI==1 || DAVINCI==4
|
||||
#define EXT1_EXTRUDER_COOLER_PIN -1
|
||||
#endif
|
||||
#if DAVINCI==2
|
||||
|
@ -834,14 +884,26 @@ on this endstop.
|
|||
|
||||
// When you have several endstops in one circuit you need to disable it after homing by moving a
|
||||
// small amount back. This is also the case with H-belt systems.
|
||||
|
||||
#if DAVINCI==0
|
||||
#define ENDSTOP_X_BACK_ON_HOME 0
|
||||
#if DAVINCI==1
|
||||
#define ENDSTOP_Y_BACK_ON_HOME 0
|
||||
#else
|
||||
#define ENDSTOP_Z_BACK_ON_HOME 0
|
||||
#endif
|
||||
|
||||
#if DAVINCI==1 || DAVINCI==4
|
||||
#define ENDSTOP_X_BACK_ON_HOME 0
|
||||
#define ENDSTOP_Y_BACK_ON_HOME 0
|
||||
#define ENDSTOP_Z_BACK_ON_HOME 0
|
||||
#endif
|
||||
|
||||
#if DAVINCI==2 || DAVINCI==3
|
||||
#define ENDSTOP_X_BACK_ON_HOME 0
|
||||
//to avoid to hit plate when homing
|
||||
#define ENDSTOP_Y_BACK_ON_HOME 7
|
||||
#endif
|
||||
#define ENDSTOP_Z_BACK_ON_HOME 0
|
||||
#endif
|
||||
|
||||
|
||||
// You can disable endstop checking for print moves. This is needed, if you get sometimes
|
||||
// false signals from your endstops. If your endstops don't give false signals, you
|
||||
|
@ -853,14 +915,32 @@ on this endstop.
|
|||
// For delta robot Z_MAX_LENGTH is the maximum travel of the towers and should be set to the distance between the hotend
|
||||
// and the platform when the printer is at its home position.
|
||||
// If EEPROM is enabled these values will be overidden with the values in the EEPROM
|
||||
#if DAVINCI==1
|
||||
#if DAVINCI==0
|
||||
#define X_MAX_LENGTH 237 - ENDSTOP_X_BACK_ON_HOME
|
||||
#define Y_MAX_LENGTH 217 - ENDSTOP_Y_BACK_ON_HOME
|
||||
#define Z_MAX_LENGTH 202 - ENDSTOP_Z_BACK_ON_HOME
|
||||
#define Z_MAX_LENGTH 190 - ENDSTOP_Z_BACK_ON_HOME
|
||||
#endif
|
||||
|
||||
#if DAVINCI==1
|
||||
#if MODEL==0
|
||||
#define Y_MAX_LENGTH 217 - ENDSTOP_Y_BACK_ON_HOME
|
||||
#else
|
||||
#define Y_MAX_LENGTH 215 - ENDSTOP_Y_BACK_ON_HOME
|
||||
#endif
|
||||
#define X_MAX_LENGTH 237 - ENDSTOP_X_BACK_ON_HOME
|
||||
#define Z_MAX_LENGTH 200 - ENDSTOP_Z_BACK_ON_HOME
|
||||
#endif
|
||||
|
||||
#if DAVINCI==2 || DAVINCI==3
|
||||
#define X_MAX_LENGTH 199 - ENDSTOP_X_BACK_ON_HOME
|
||||
#define Y_MAX_LENGTH 211 - ENDSTOP_Y_BACK_ON_HOME
|
||||
#define Z_MAX_LENGTH 202 - ENDSTOP_Z_BACK_ON_HOME
|
||||
#define Z_MAX_LENGTH 200 - ENDSTOP_Z_BACK_ON_HOME
|
||||
#endif
|
||||
|
||||
#if DAVINCI==4
|
||||
#define X_MAX_LENGTH 223.60 - ENDSTOP_X_BACK_ON_HOME
|
||||
#define Y_MAX_LENGTH 220.60 - ENDSTOP_Y_BACK_ON_HOME
|
||||
#define Z_MAX_LENGTH 190 - ENDSTOP_Z_BACK_ON_HOME
|
||||
#endif
|
||||
|
||||
// Coordinates for the minimum axis. Can also be negative if you want to have the bed start at 0 and the printer can go to the left side
|
||||
|
@ -869,7 +949,21 @@ on this endstop.
|
|||
#define X_MIN_POS -33
|
||||
#define Y_MIN_POS -12
|
||||
#define Z_MIN_POS 0
|
||||
#else
|
||||
#endif
|
||||
|
||||
#if DAVINCI==2 || DAVINCI==3
|
||||
#define X_MIN_POS 0
|
||||
#define Y_MIN_POS 0
|
||||
#define Z_MIN_POS 0
|
||||
#endif
|
||||
|
||||
#if DAVINCI==4
|
||||
#define X_MIN_POS -14.60
|
||||
#define Y_MIN_POS -12.60
|
||||
#define Z_MIN_POS 0
|
||||
#endif
|
||||
|
||||
#if DAVINCI==0
|
||||
#define X_MIN_POS 0
|
||||
#define Y_MIN_POS 0
|
||||
#define Z_MIN_POS 0
|
||||
|
@ -1310,7 +1404,11 @@ See: AdditionalArduinoFiles: README.txt on how to install them.
|
|||
#define Z_PROBE_SWITCHING_DISTANCE 1 // Distance to safely switch off probe
|
||||
#define Z_PROBE_REPETITIONS 1 // Repetitions for probing at one point.
|
||||
/** The height is the difference between activated probe position and nozzle height. */
|
||||
#if MODEL==0
|
||||
#define Z_PROBE_HEIGHT 0.28
|
||||
#else
|
||||
#define Z_PROBE_HEIGHT 0.54
|
||||
#endif
|
||||
/** These scripts are run before resp. after the z-probe is done. Add here code to activate/deactivate probe if needed. */
|
||||
#define Z_PROBE_START_SCRIPT ""
|
||||
#define Z_PROBE_FINISHED_SCRIPT ""
|
||||
|
@ -1324,9 +1422,14 @@ See: AdditionalArduinoFiles: README.txt on how to install them.
|
|||
#define Z_PROBE_X1 -7
|
||||
#define Z_PROBE_Y1 -10
|
||||
#define Z_PROBE_X2 -7
|
||||
#define Z_PROBE_Y2 205
|
||||
#define Z_PROBE_X3 179
|
||||
#if MODEL==0
|
||||
#define Z_PROBE_Y2 205
|
||||
#define Z_PROBE_Y3 205
|
||||
#else
|
||||
#define Z_PROBE_Y2 203
|
||||
#define Z_PROBE_Y3 203
|
||||
#endif
|
||||
//Manual bed leveling
|
||||
#define MANUAL_LEVEL_X1 100
|
||||
#define MANUAL_LEVEL_Y1 190
|
||||
|
@ -1336,7 +1439,45 @@ See: AdditionalArduinoFiles: README.txt on how to install them.
|
|||
#define MANUAL_LEVEL_Y3 100
|
||||
#define MANUAL_LEVEL_X4 190
|
||||
#define MANUAL_LEVEL_Y4 100
|
||||
#else
|
||||
#endif
|
||||
|
||||
#if DAVINCI==2 || DAVINCI==3
|
||||
#define Z_PROBE_X1 36
|
||||
#define Z_PROBE_Y1 -7
|
||||
#define Z_PROBE_X2 36
|
||||
#define Z_PROBE_Y2 203
|
||||
#define Z_PROBE_X3 171
|
||||
#define Z_PROBE_Y3 203
|
||||
//Manual bed leveling
|
||||
#define MANUAL_LEVEL_X1 100
|
||||
#define MANUAL_LEVEL_Y1 180
|
||||
#define MANUAL_LEVEL_X2 100
|
||||
#define MANUAL_LEVEL_Y2 10
|
||||
#define MANUAL_LEVEL_X3 50
|
||||
#define MANUAL_LEVEL_Y3 95
|
||||
#define MANUAL_LEVEL_X4 150
|
||||
#define MANUAL_LEVEL_Y4 95
|
||||
#endif
|
||||
|
||||
#if DAVINCI==4
|
||||
#define Z_PROBE_X1 -3
|
||||
#define Z_PROBE_Y1 -7
|
||||
#define Z_PROBE_X2 -3
|
||||
#define Z_PROBE_Y2 204
|
||||
#define Z_PROBE_X3 184
|
||||
#define Z_PROBE_Y3 204
|
||||
//Manual bed leveling
|
||||
#define MANUAL_LEVEL_X1 100
|
||||
#define MANUAL_LEVEL_Y1 190
|
||||
#define MANUAL_LEVEL_X2 100
|
||||
#define MANUAL_LEVEL_Y2 10
|
||||
#define MANUAL_LEVEL_X3 10
|
||||
#define MANUAL_LEVEL_Y3 100
|
||||
#define MANUAL_LEVEL_X4 190
|
||||
#define MANUAL_LEVEL_Y4 100
|
||||
#endif
|
||||
|
||||
#if DAVINCI==0
|
||||
#define Z_PROBE_X1 36
|
||||
#define Z_PROBE_Y1 -7
|
||||
#define Z_PROBE_X2 36
|
||||
|
@ -1410,9 +1551,10 @@ Always hard to say since the other angle is 89° in this case!
|
|||
/* If you have a threaded rod, you want a higher multiplicator to see an effect. Limit value to 50 or you get easily overflows.*/
|
||||
#define BABYSTEP_MULTIPLICATOR 1
|
||||
|
||||
/* Define a pin to tuen light on/off */
|
||||
/* Define a pin to turn light on/off */
|
||||
#define CASE_LIGHTS_PIN LIGHT_PIN
|
||||
#define CASE_LIGHT_DEFAULT_ON 1
|
||||
#define CASE_BADGE_LIGHT_DEFAULT_ON 1
|
||||
|
||||
/** Set to false to disable SD support: */
|
||||
#ifndef SDSUPPORT // Some boards have sd support on board. These define the values already in pins.h
|
||||
|
@ -1445,7 +1587,7 @@ is also used for the heater if you have 2 extruders connected. */
|
|||
#if REPURPOSE_FAN_TO_COOL_EXTRUSIONS==1
|
||||
#define FEATURE_FAN_CONTROL 1
|
||||
#define FAN_PIN ORIG_FAN_PIN
|
||||
#if DAVINCI>=2
|
||||
#if DAVINCI==2 || DAVINCI==3
|
||||
#define EXT0_EXTRUDER_COOLER_PIN ORIG_FAN2_PIN
|
||||
#define EXT1_EXTRUDER_COOLER_PIN ORIG_FAN2_PIN
|
||||
#else //DaVinci 1.0
|
||||
|
@ -1499,20 +1641,30 @@ Select the language to use.
|
|||
#define UI_LANGUAGE 0
|
||||
|
||||
// This is line 2 of the status display at startup. Change to your like.
|
||||
#if DAVINCI==0
|
||||
#define UI_PRINTER_NAME " My Printer "
|
||||
#define DAVINCI_TYPE "0"
|
||||
#endif
|
||||
#if DAVINCI==1
|
||||
#define UI_PRINTER_NAME " Da Vinci 1.0"
|
||||
#define DAVINCI_TYPE "1"
|
||||
#else
|
||||
#define UI_PRINTER_NAME " Da Vinci 2.0"
|
||||
#endif
|
||||
#if DAVINCI==2
|
||||
#define UI_PRINTER_NAME " Da Vinci 2.0"
|
||||
#define DAVINCI_TYPE "2"
|
||||
#else
|
||||
#endif
|
||||
#if DAVINCI==3
|
||||
#define UI_PRINTER_NAME " Da Vinci 2.0"
|
||||
#define DAVINCI_TYPE "3"
|
||||
#endif
|
||||
#if DAVINCI==4
|
||||
#define UI_PRINTER_NAME " Da Vinci AiO"
|
||||
#define DAVINCI_TYPE "4"
|
||||
#endif
|
||||
|
||||
#define UI_PRINTER_COMPANY "By XYZ Printing"
|
||||
|
||||
#if MODEL == 0
|
||||
#if MODEL == 0 || DAVINCI==0
|
||||
#define MODEL_TYPE " "
|
||||
#else
|
||||
#define MODEL_TYPE "A"
|
||||
|
@ -1539,7 +1691,7 @@ info pages with next/previous button/click-encoder */
|
|||
Unfotunately, the encoder have a different count of phase changes between clicks.
|
||||
Select an encoder speed from 0 = fastest to 2 = slowest that results in one menu move per click.
|
||||
*/
|
||||
#define UI_ENCODER_SPEED 0
|
||||
#define UI_ENCODER_SPEED 2
|
||||
|
||||
// Set to 1 to reverse encoder direction
|
||||
#define UI_REVERSE_ENCODER 0
|
||||
|
@ -1584,6 +1736,12 @@ Values must be in range 1..255
|
|||
#define UI_SET_PRESET_EXTRUDER_TEMP_PLA 180
|
||||
#define UI_SET_PRESET_HEATED_BED_TEMP_ABS 90
|
||||
#define UI_SET_PRESET_EXTRUDER_TEMP_ABS 230
|
||||
|
||||
// Loading / Unloading Filament value
|
||||
#define UI_SET_PRESET_LOADING_FEEDRATE 2
|
||||
#define UI_SET_PRESET_UNLOADING_FEEDRATE 4
|
||||
#define UI_SET_PRESET_UNLOAD_LOAD_DISTANCE 60
|
||||
|
||||
// Extreme values
|
||||
#define UI_SET_MIN_HEATED_BED_TEMP 30
|
||||
#define UI_SET_MAX_HEATED_BED_TEMP 130
|
||||
|
|
|
@ -96,7 +96,12 @@ void EEPROM::restoreEEPROMSettingsFromConfiguration()
|
|||
baudrate = BAUDRATE;
|
||||
maxInactiveTime = MAX_INACTIVE_TIME * 1000L;
|
||||
//Davinci Specific
|
||||
#if CASE_LIGHTS_PIN > 0
|
||||
EEPROM::buselight = bool(CASE_LIGHT_DEFAULT_ON);
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > -1
|
||||
EEPROM::busebadgelight = bool(CASE_BADGE_LIGHT_DEFAULT_ON);
|
||||
#endif
|
||||
EEPROM::bkeeplighton = bool(CASE_KEEP_LIGHT_DEFAULT_ON);
|
||||
UIDisplay::display_mode=CASE_DISPLAY_MODE_DEFAULT;
|
||||
#if FEATURE_BEEPER
|
||||
|
@ -104,13 +109,22 @@ void EEPROM::restoreEEPROMSettingsFromConfiguration()
|
|||
#endif
|
||||
EEPROM::busesensor = bool(CASE_FILAMENT_SENSOR_DEFAULT_ON);
|
||||
EEPROM::btopsensor = bool(CASE_TOP_SENSOR_DEFAULT_ON);
|
||||
#if ENABLE_WIFI
|
||||
HAL::bwifion = bool(CASE_WIFI_DEFAULT_ON);
|
||||
#endif
|
||||
EEPROM::ftemp_ext_pla=UI_SET_PRESET_EXTRUDER_TEMP_PLA;
|
||||
EEPROM::ftemp_ext_abs=UI_SET_PRESET_EXTRUDER_TEMP_ABS;
|
||||
EEPROM::ftemp_bed_pla=UI_SET_PRESET_HEATED_BED_TEMP_PLA;
|
||||
EEPROM::ftemp_bed_abs=UI_SET_PRESET_HEATED_BED_TEMP_ABS;
|
||||
EEPROM::loading_feed_rate=UI_SET_PRESET_LOADING_FEEDRATE;
|
||||
EEPROM::unloading_feed_rate=UI_SET_PRESET_UNLOADING_FEEDRATE;
|
||||
EEPROM::unloading_loading_distance=UI_SET_PRESET_UNLOAD_LOAD_DISTANCE;
|
||||
#if CASE_LIGHTS_PIN>=0
|
||||
WRITE(CASE_LIGHTS_PIN, byte(EEPROM::buselight));
|
||||
#endif // CASE_LIGHTS_PIN
|
||||
#if BADGE_LIGHT_PIN>=0
|
||||
WRITE(BADGE_LIGHT_PIN, byte(EEPROM::busebadgelight & EEPROM::buselight));
|
||||
#endif // BADGE_LIGHT_PIN
|
||||
stepperInactiveTime = STEPPER_INACTIVE_TIME * 1000L;
|
||||
Printer::axisStepsPerMM[X_AXIS] = XAXIS_STEPS_PER_MM;
|
||||
Printer::axisStepsPerMM[Y_AXIS] = YAXIS_STEPS_PER_MM;
|
||||
|
@ -360,6 +374,7 @@ void EEPROM::restoreEEPROMSettingsFromConfiguration()
|
|||
}
|
||||
//Davinci Specific
|
||||
bool EEPROM::buselight=false;
|
||||
bool EEPROM::busebadgelight=false;
|
||||
bool EEPROM::busesensor=false;
|
||||
bool EEPROM::btopsensor=false;
|
||||
bool EEPROM::bkeeplighton=true;
|
||||
|
@ -367,6 +382,9 @@ float EEPROM::ftemp_ext_pla=UI_SET_PRESET_EXTRUDER_TEMP_PLA;
|
|||
float EEPROM::ftemp_ext_abs=UI_SET_PRESET_EXTRUDER_TEMP_ABS;
|
||||
float EEPROM::ftemp_bed_pla=UI_SET_PRESET_HEATED_BED_TEMP_PLA;
|
||||
float EEPROM::ftemp_bed_abs=UI_SET_PRESET_HEATED_BED_TEMP_ABS;
|
||||
float EEPROM::loading_feed_rate=UI_SET_PRESET_LOADING_FEEDRATE;
|
||||
float EEPROM::unloading_feed_rate=UI_SET_PRESET_UNLOADING_FEEDRATE;
|
||||
float EEPROM::unloading_loading_distance=UI_SET_PRESET_UNLOAD_LOAD_DISTANCE;
|
||||
|
||||
#if UI_AUTOLIGHTOFF_AFTER !=0
|
||||
millis_t EEPROM::timepowersaving=1000 * 60 * 30; //30 min
|
||||
|
@ -434,8 +452,13 @@ void EEPROM::storeDataIntoEEPROM(uint8_t corrupted)
|
|||
#endif
|
||||
|
||||
//Davinci Specific
|
||||
#if CASE_LIGHTS_PIN > 0
|
||||
HAL::eprSetByte(EPR_LIGHT_ON,EEPROM::buselight);
|
||||
HAL::eprSetByte(EPR_KEEP_LIGHT_ON,EEPROM::bkeeplighton);
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > -1
|
||||
HAL::eprSetByte(EPR_BADGE_LIGHT_ON,EEPROM::busebadgelight);
|
||||
#endif
|
||||
|
||||
HAL::eprSetByte(EPR_DISPLAY_MODE,UIDisplay::display_mode);
|
||||
#if defined(FIL_SENSOR1_PIN)
|
||||
|
@ -444,6 +467,9 @@ void EEPROM::storeDataIntoEEPROM(uint8_t corrupted)
|
|||
#if defined(TOP_SENSOR_PIN)
|
||||
HAL::eprSetByte(EPR_TOP_SENSOR_ON,EEPROM::btopsensor);
|
||||
#endif
|
||||
#if ENABLE_WIFI
|
||||
HAL::eprSetByte(EPR_WIFI_ON,HAL::bwifion);
|
||||
#endif
|
||||
#if FEATURE_BEEPER
|
||||
HAL::eprSetByte(EPR_SOUND_ON,HAL::enablesound);
|
||||
#endif
|
||||
|
@ -462,6 +488,9 @@ void EEPROM::storeDataIntoEEPROM(uint8_t corrupted)
|
|||
HAL::eprSetFloat(EPR_TEMP_BED_ABS, EEPROM::ftemp_bed_abs);
|
||||
HAL::eprSetFloat(EPR_TEMP_EXT_PLA, EEPROM::ftemp_ext_pla);
|
||||
HAL::eprSetFloat(EPR_TEMP_EXT_ABS, EEPROM::ftemp_ext_abs);
|
||||
HAL::eprSetFloat(EPR_LOAD_FEED_RATE, EEPROM::loading_feed_rate);
|
||||
HAL::eprSetFloat(EPR_UNLOAD_FEED_RATE, EEPROM::unloading_feed_rate);
|
||||
HAL::eprSetFloat(EPR_UNLOAD_LOAD_DISTANCE, EEPROM::unloading_loading_distance);
|
||||
#if ENABLE_BACKLASH_COMPENSATION
|
||||
HAL::eprSetFloat(EPR_BACKLASH_X,Printer::backlashX);
|
||||
HAL::eprSetFloat(EPR_BACKLASH_Y,Printer::backlashY);
|
||||
|
@ -561,6 +590,9 @@ void EEPROM::initalizeUncached()
|
|||
HAL::eprSetFloat(EPR_TEMP_BED_ABS, EEPROM::ftemp_bed_abs);
|
||||
HAL::eprSetFloat(EPR_TEMP_EXT_PLA, EEPROM::ftemp_ext_pla);
|
||||
HAL::eprSetFloat(EPR_TEMP_EXT_ABS, EEPROM::ftemp_ext_abs);
|
||||
HAL::eprSetFloat(EPR_LOAD_FEED_RATE, EEPROM::loading_feed_rate);
|
||||
HAL::eprSetFloat(EPR_UNLOAD_FEED_RATE, EEPROM::unloading_feed_rate);
|
||||
HAL::eprSetFloat(EPR_UNLOAD_LOAD_DISTANCE, EEPROM::unloading_loading_distance);
|
||||
HAL::eprSetFloat(EPR_AXISCOMP_TANXY,AXISCOMP_TANXY);
|
||||
HAL::eprSetFloat(EPR_AXISCOMP_TANYZ,AXISCOMP_TANYZ);
|
||||
HAL::eprSetFloat(EPR_AXISCOMP_TANXZ,AXISCOMP_TANXZ);
|
||||
|
@ -650,20 +682,31 @@ void EEPROM::readDataFromEEPROM()
|
|||
Printer::radius0 = HAL::eprGetFloat(EPR_DELTA_HORIZONTAL_RADIUS);
|
||||
#endif
|
||||
//Davinci Specific
|
||||
#if CASE_LIGHTS_PIN > 0
|
||||
EEPROM::buselight=HAL::eprGetByte(EPR_LIGHT_ON);
|
||||
EEPROM::bkeeplighton=HAL::eprGetByte(EPR_KEEP_LIGHT_ON);
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > -1
|
||||
EEPROM::busebadgelight=HAL::eprGetByte(EPR_BADGE_LIGHT_ON);
|
||||
#endif
|
||||
UIDisplay::display_mode=HAL::eprGetByte(EPR_DISPLAY_MODE);
|
||||
//need to be sure a valid value is set
|
||||
if(!((UIDisplay::display_mode==ADVANCED_MODE)||(UIDisplay::display_mode==EASY_MODE)))UIDisplay::display_mode=ADVANCED_MODE;
|
||||
#if CASE_LIGHTS_PIN>=0
|
||||
WRITE(CASE_LIGHTS_PIN, byte(EEPROM::buselight));
|
||||
#endif // CASE_LIGHTS_PIN
|
||||
#if BADGE_LIGHT_PIN>=0
|
||||
WRITE(BADGE_LIGHT_PIN, byte(EEPROM::busebadgelight & EEPROM::buselight));
|
||||
#endif // BADGE_LIGHT_PIN
|
||||
#if defined(FIL_SENSOR1_PIN)
|
||||
EEPROM::busesensor=HAL::eprGetByte(EPR_FIL_SENSOR_ON);
|
||||
#endif
|
||||
#if defined(TOP_SENSOR_PIN)
|
||||
EEPROM::btopsensor=HAL::eprGetByte(EPR_TOP_SENSOR_ON);
|
||||
#endif
|
||||
#if ENABLE_WIFI
|
||||
HAL::bwifion=HAL::eprGetByte(EPR_WIFI_ON);
|
||||
#endif
|
||||
#if FEATURE_BEEPER
|
||||
HAL::enablesound=HAL::eprGetByte(EPR_SOUND_ON);
|
||||
#endif
|
||||
|
@ -676,6 +719,9 @@ EEPROM::ftemp_ext_pla= HAL::eprGetFloat(EPR_TEMP_EXT_PLA);
|
|||
EEPROM::ftemp_ext_abs= HAL::eprGetFloat(EPR_TEMP_EXT_ABS);
|
||||
EEPROM::ftemp_bed_pla= HAL::eprGetFloat(EPR_TEMP_BED_PLA);
|
||||
EEPROM::ftemp_bed_abs= HAL::eprGetFloat(EPR_TEMP_BED_ABS);
|
||||
EEPROM::loading_feed_rate= HAL::eprGetFloat(EPR_LOAD_FEED_RATE);
|
||||
EEPROM::unloading_feed_rate= HAL::eprGetFloat(EPR_UNLOAD_FEED_RATE);
|
||||
EEPROM::unloading_loading_distance= HAL::eprGetFloat(EPR_UNLOAD_LOAD_DISTANCE);
|
||||
#if ENABLE_BACKLASH_COMPENSATION
|
||||
Printer::backlashX = HAL::eprGetFloat(EPR_BACKLASH_X);
|
||||
Printer::backlashY = HAL::eprGetFloat(EPR_BACKLASH_Y);
|
||||
|
@ -939,9 +985,14 @@ void EEPROM::writeSettings()
|
|||
writeLong(EPR_BAUDRATE, Com::tEPRBaudrate);
|
||||
//Davinci Specific
|
||||
writeByte(EPR_DISPLAY_MODE, Com::tDisplayMode);
|
||||
#if CASE_LIGHTS_PIN > 0
|
||||
writeByte(EPR_LIGHT_ON,Com::tLightOn);
|
||||
writeByte(EPR_KEEP_LIGHT_ON,Com::tKeepLightOn);
|
||||
#if defined(FIL_SENSOR1_PIN)
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > -1
|
||||
writeByte(EPR_BADGE_LIGHT_ON,Com::tBadgeLightOn);
|
||||
#endif
|
||||
#if defined(FIL_SENSOR1_PIN)
|
||||
writeByte(EPR_FIL_SENSOR_ON,Com::tSensorOn);
|
||||
#endif
|
||||
#if defined(TOP_SENSOR_PIN)
|
||||
|
@ -949,6 +1000,9 @@ void EEPROM::writeSettings()
|
|||
#endif
|
||||
#if FEATURE_BEEPER
|
||||
writeByte(EPR_SOUND_ON,Com::tSoundOn);
|
||||
#endif
|
||||
#if ENABLE_WIFI
|
||||
writeByte(EPR_WIFI_ON,Com::tWifiOn);
|
||||
#endif
|
||||
writeFloat(EPR_PRINTING_DISTANCE, Com::tEPRFilamentPrinted);
|
||||
writeLong(EPR_PRINTING_TIME, Com::tEPRPrinterActive);
|
||||
|
@ -962,6 +1016,9 @@ void EEPROM::writeSettings()
|
|||
writeFloat(EPR_TEMP_EXT_ABS,Com::tTempExtABS);
|
||||
writeFloat(EPR_TEMP_BED_PLA,Com::tTempBedPLA);
|
||||
writeFloat(EPR_TEMP_BED_ABS,Com::tTempBedABS);
|
||||
writeFloat(EPR_LOAD_FEED_RATE,Com::tLoadFeedRate);
|
||||
writeFloat(EPR_UNLOAD_FEED_RATE,Com::tUnloadFeedRate);
|
||||
writeFloat(EPR_UNLOAD_LOAD_DISTANCE,Com::tUnloadLoadDistance);
|
||||
//#define EPR_ACCELERATION_TYPE 1
|
||||
#if DRIVE_SYSTEM != DELTA
|
||||
writeFloat(EPR_XAXIS_STEPS_PER_MM, Com::tEPRXStepsPerMM, 4);
|
||||
|
|
|
@ -142,6 +142,11 @@ have problems with other modules using the eeprom */
|
|||
#define EPR_TEMP_BED_PLA 1168
|
||||
#define EPR_TEMP_BED_ABS 1172
|
||||
#define EPR_TOP_SENSOR_ON 1176
|
||||
#define EPR_WIFI_ON 1177
|
||||
#define EPR_BADGE_LIGHT_ON 1178
|
||||
#define EPR_LOAD_FEED_RATE 1179
|
||||
#define EPR_UNLOAD_FEED_RATE 1183
|
||||
#define EPR_UNLOAD_LOAD_DISTANCE 1187
|
||||
|
||||
#if EEPROM_MODE != 0
|
||||
#define EEPROM_FLOAT(x) HAL::eprGetFloat(EPR_##x)
|
||||
|
@ -212,6 +217,7 @@ public:
|
|||
static void initBaudrate();
|
||||
//Davinci Specific
|
||||
static bool buselight;
|
||||
static bool busebadgelight;
|
||||
static bool busesensor;
|
||||
static bool btopsensor;
|
||||
static bool bkeeplighton;
|
||||
|
@ -220,6 +226,9 @@ public:
|
|||
static float ftemp_bed_pla;
|
||||
static float ftemp_bed_abs;
|
||||
static millis_t timepowersaving;
|
||||
static float loading_feed_rate;
|
||||
static float unloading_feed_rate;
|
||||
static float unloading_loading_distance;
|
||||
static void storeDataIntoEEPROM(uint8_t corrupted=0);
|
||||
static void readDataFromEEPROM();
|
||||
static void restoreEEPROMSettingsFromConfiguration();
|
||||
|
|
|
@ -586,7 +586,7 @@ void Extruder::selectExtruderById(uint8_t extruderId, bool changepos)
|
|||
float oldfeedrate = Printer::feedrate;
|
||||
Printer::offsetX = -Extruder::current->xOffset * Printer::invAxisStepsPerMM[X_AXIS];
|
||||
Printer::offsetY = -Extruder::current->yOffset * Printer::invAxisStepsPerMM[Y_AXIS];
|
||||
Commands::changeFeedrateMultiply(Printer::extrudeMultiply); // needed to adjust extrusionFactor to possibly different diameter
|
||||
Commands::changeFlowrateMultiply(Printer::extrudeMultiply); // needed to adjust extrusionFactor to possibly different diameter
|
||||
//Davinci Specific, check if move extruder for DUO
|
||||
if(Printer::isHomed() && changepos)
|
||||
Printer::moveToReal(cx, cy, cz, IGNORE_COORDINATE, Printer::homingFeedrate[X_AXIS]);
|
||||
|
|
|
@ -60,6 +60,14 @@ HAL::~HAL()
|
|||
}
|
||||
|
||||
//Davinci Specific
|
||||
#if FEATURE_BEEPER
|
||||
bool HAL::enablesound = true;
|
||||
#endif
|
||||
|
||||
#if ENABLE_WIFI
|
||||
bool HAL::bwifion=false;
|
||||
#endif //wifi feature
|
||||
|
||||
#ifdef SDEEPROM
|
||||
#if !SDSUPPORT
|
||||
#error SDEEPROM requires SDCARSUPPORT
|
||||
|
@ -70,10 +78,6 @@ HAL::~HAL()
|
|||
|
||||
#define SDEEPROM_SIZE 2048 // Minimum size used by Eeprom.cpp
|
||||
|
||||
#if FEATURE_BEEPER
|
||||
bool HAL::enablesound = true;
|
||||
#endif
|
||||
|
||||
char HAL::sdEepromImage[SDEEPROM_SIZE] = { 0, };
|
||||
uint32_t HAL::sdEepromLastChanged = 0; // 0 = never.
|
||||
|
||||
|
|
|
@ -281,6 +281,10 @@ public:
|
|||
#if FEATURE_BEEPER
|
||||
static bool enablesound;
|
||||
#endif //FEATURE_BEEPER
|
||||
#if ENABLE_WIFI
|
||||
static bool bwifion;
|
||||
#endif //wifi feature
|
||||
|
||||
// do any hardware-specific initialization here
|
||||
static inline void hwSetup(void)
|
||||
{
|
||||
|
@ -552,22 +556,48 @@ public:
|
|||
}
|
||||
static inline void serialSetBaudrate(long baud)
|
||||
{
|
||||
#if ENABLE_WIFI
|
||||
WIFI_SERIAL.begin(baud);
|
||||
#endif
|
||||
RFSERIAL.begin(baud);
|
||||
}
|
||||
static inline bool serialByteAvailable()
|
||||
{
|
||||
#if ENABLE_WIFI
|
||||
if(HAL::bwifion) return WIFI_SERIAL.available();
|
||||
else
|
||||
#endif
|
||||
return RFSERIAL.available();
|
||||
}
|
||||
static inline uint8_t serialReadByte()
|
||||
{
|
||||
#if ENABLE_WIFI
|
||||
if(HAL::bwifion) return WIFI_SERIAL.read();
|
||||
else
|
||||
#endif
|
||||
return RFSERIAL.read();
|
||||
}
|
||||
static inline void serialWriteByte(char b)
|
||||
{
|
||||
#if ENABLE_WIFI
|
||||
if(HAL::bwifion)
|
||||
{
|
||||
WIFI_SERIAL.write(b);
|
||||
if (b=='\n')
|
||||
{
|
||||
HAL::delayMilliseconds(DELAY_BY_LINE);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
RFSERIAL.write(b);
|
||||
}
|
||||
static inline void serialFlush()
|
||||
{
|
||||
#if ENABLE_WIFI
|
||||
if(HAL::bwifion) WIFI_SERIAL.flush();
|
||||
else
|
||||
#endif
|
||||
RFSERIAL.flush();
|
||||
}
|
||||
static void setupTimer();
|
||||
|
@ -702,11 +732,25 @@ public:
|
|||
|
||||
|
||||
// Watchdog support
|
||||
inline static void startWatchdog() { WDT->WDT_MR = WDT_MR_WDRSTEN | WATCHDOG_INTERVAL | (WATCHDOG_INTERVAL << 16);WDT->WDT_CR = 0xA5000001;};
|
||||
inline static void stopWatchdog() {}
|
||||
//Davinci Specific
|
||||
//inline static void startWatchdog() { WDT->WDT_MR = WDT_MR_WDRSTEN | WATCHDOG_INTERVAL | (WATCHDOG_INTERVAL << 16);WDT->WDT_CR = 0xA5000001;};
|
||||
//Enable the watchdog with the specified timeout. Should only be called once.
|
||||
//timeout in milliseconds.
|
||||
inline static void startWatchdog() {
|
||||
#if FEATURE_WATCHDOG
|
||||
uint32_t timeout = 8000 * 256 / 1000; //8000ms = 8s
|
||||
if (timeout == 0) timeout = 1;
|
||||
else if (timeout > 0xFFF) timeout = 0xFFF;
|
||||
timeout = WDT_MR_WDRSTEN | WDT_MR_WDV(timeout) | WDT_MR_WDD(timeout);
|
||||
WDT_Enable (WDT, timeout);
|
||||
#endif
|
||||
}
|
||||
inline static void stopWatchdog() {WDT_Disable (WDT);}
|
||||
|
||||
inline static void pingWatchdog() {
|
||||
#if FEATURE_WATCHDOG
|
||||
WDT->WDT_CR = 0xA5000001;
|
||||
//WDT->WDT_CR = 0xA5000001;
|
||||
WDT_Restart (WDT);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ void Printer::cleanNozzle(bool restoreposition)
|
|||
if (currentPosition[Z_AXIS] < zMin+15) moveToReal(IGNORE_COORDINATE,IGNORE_COORDINATE,zMin+15,IGNORE_COORDINATE,homingFeedrate[0]);
|
||||
Commands::waitUntilEndOfAllMoves();
|
||||
UI_STATUS_UPD_RAM(UI_TEXT_CLEANING_NOZZLE);
|
||||
#if DAVINCI ==1
|
||||
#if DAVINCI ==1
|
||||
//first step noze
|
||||
moveToReal(xMin+CLEAN_X-ENDSTOP_X_BACK_ON_HOME,yMin,IGNORE_COORDINATE,IGNORE_COORDINATE,homingFeedrate[0]);
|
||||
//second step noze
|
||||
|
@ -215,7 +215,22 @@ void Printer::cleanNozzle(bool restoreposition)
|
|||
moveToReal(xMin,yMin+CLEAN_Y-ENDSTOP_Y_BACK_ON_HOME,IGNORE_COORDINATE,IGNORE_COORDINATE,homingFeedrate[0]);
|
||||
//sixth step Z probe
|
||||
moveToReal(xMin,yMin-ENDSTOP_Y_BACK_ON_HOME,IGNORE_COORDINATE,IGNORE_COORDINATE,homingFeedrate[0]);
|
||||
#else
|
||||
#endif
|
||||
#if DAVINCI ==4 || DAVINCI ==0
|
||||
moveToReal(IGNORE_COORDINATE,IGNORE_COORDINATE,zMin+3,IGNORE_COORDINATE,homingFeedrate[Z_AXIS]);
|
||||
Commands::waitUntilEndOfAllMoves();
|
||||
//first step noze
|
||||
moveToReal(xMin,yMin+CLEAN_Y-1,IGNORE_COORDINATE,IGNORE_COORDINATE,homingFeedrate[0]);
|
||||
//second step
|
||||
moveToReal(xMin+CLEAN_X,IGNORE_COORDINATE,IGNORE_COORDINATE,IGNORE_COORDINATE,homingFeedrate[0]);
|
||||
//third step
|
||||
moveToReal(xMin,yMin+CLEAN_Y,IGNORE_COORDINATE,IGNORE_COORDINATE,homingFeedrate[0]);
|
||||
//fourth step
|
||||
moveToReal(xMin+CLEAN_X,yMin+CLEAN_Y+1,IGNORE_COORDINATE,IGNORE_COORDINATE,homingFeedrate[0]);
|
||||
//fifth step
|
||||
moveToReal(xMin,yMin+CLEAN_Y+2,IGNORE_COORDINATE,IGNORE_COORDINATE,homingFeedrate[0]);
|
||||
#endif
|
||||
#if DAVINCI ==2 || DAVINCI ==3
|
||||
//first step
|
||||
moveToReal(xMin + CLEAN_X-ENDSTOP_X_BACK_ON_HOME,yMin + CLEAN_Y-ENDSTOP_Y_BACK_ON_HOME,IGNORE_COORDINATE,IGNORE_COORDINATE,homingFeedrate[0]);
|
||||
//second step
|
||||
|
@ -662,6 +677,9 @@ void Printer::setup()
|
|||
//Davinci Specific, we start watch dog from begining
|
||||
#if FEATURE_WATCHDOG
|
||||
HAL::startWatchdog();
|
||||
HAL::pingWatchdog();
|
||||
#else
|
||||
HAL::stopWatchdog();
|
||||
#endif // FEATURE_WATCHDOG
|
||||
#if FEATURE_CONTROLLER == CONTROLLER_VIKI
|
||||
HAL::delayMilliseconds(100);
|
||||
|
@ -935,6 +953,11 @@ SET_INPUT(FIL_SENSOR2_PIN);
|
|||
//Davinci Specific, we power on lights based on state set in EEPROM
|
||||
WRITE(CASE_LIGHTS_PIN, EEPROM::buselight);
|
||||
#endif // CASE_LIGHTS_PIN
|
||||
#if BADGE_LIGHT_PIN >= 0
|
||||
SET_OUTPUT(BADGE_LIGHT_PIN);
|
||||
//Davinci Specific, we power on lights based on state set in EEPROM
|
||||
WRITE(BADGE_LIGHT_PIN, EEPROM::buselight & EEPROM::busebadgelight);
|
||||
#endif // EEPROM::buselight
|
||||
#if GANTRY
|
||||
Printer::motorX = 0;
|
||||
Printer::motorYorZ = 0;
|
||||
|
@ -987,6 +1010,16 @@ SET_INPUT(FIL_SENSOR2_PIN);
|
|||
#if USE_ADVANCE
|
||||
extruderStepsNeeded = 0;
|
||||
#endif
|
||||
//Davinci Specific, setup SD Card EEPROM
|
||||
#if SDSUPPORT
|
||||
#ifdef SDEEPROM
|
||||
HAL::setupSdEeprom();
|
||||
#endif
|
||||
sd.initsd();
|
||||
#endif
|
||||
HAL::loadVirtualEEPROM();
|
||||
// sets autoleveling in eeprom init
|
||||
EEPROM::init(); // Read settings from eeprom if wanted
|
||||
EEPROM::initBaudrate();
|
||||
HAL::serialSetBaudrate(baudrate);
|
||||
Com::printFLN(Com::tStart);
|
||||
|
@ -994,16 +1027,7 @@ SET_INPUT(FIL_SENSOR2_PIN);
|
|||
//UI_INITIALIZE;
|
||||
HAL::showStartReason();
|
||||
Extruder::initExtruder();
|
||||
//Davinci Specific, setup SD Card EEPROM
|
||||
#if SDSUPPORT
|
||||
#ifdef SDEEPROM
|
||||
HAL::setupSdEeprom();
|
||||
#endif
|
||||
sd.initsd();
|
||||
#endif
|
||||
HAL::loadVirtualEEPROM();
|
||||
// sets autoleveling in eeprom init
|
||||
EEPROM::init(); // Read settings from eeprom if wanted
|
||||
|
||||
for(uint8_t i = 0; i < E_AXIS_ARRAY; i++)
|
||||
{
|
||||
currentPositionSteps[i] = 0;
|
||||
|
|
|
@ -43,7 +43,7 @@ Implemented Codes
|
|||
- G11 S<1 = long retract, 0 = short retract = default> = Undo retraction according to stored setting
|
||||
- G20 - Units for G0/G1 are inches.
|
||||
- G21 - Units for G0/G1 are mm.
|
||||
- G28 - Home all axis or named axis.
|
||||
- G28 - Home all axis or named axis like G28 X Y
|
||||
- G29 S<0..2> - Z-Probe at the 3 defined probe points. S = 1 measure avg. zHeight, S = 2 store avg zHeight
|
||||
- G30 P<0..3> - Single z-probe at current position P = 1 first measurement, P = 2 Last measurement P = 0 or 3 first and last measurement
|
||||
- G31 - Write signal of probe sensor
|
||||
|
@ -53,13 +53,15 @@ Implemented Codes
|
|||
- G92 - Set current position to cordinates given
|
||||
- G131 - set extruder offset position to 0 - needed for calibration with G132
|
||||
- G132 - calibrate endstop positions. Call this, after calling G131 and after centering the extruder holder.
|
||||
- T0 - select extruder 1
|
||||
- T1 - select extruder 2
|
||||
|
||||
RepRap M Codes
|
||||
|
||||
- M104 - Set extruder target temp
|
||||
- M105 - Read current temp
|
||||
- M106 - Fan on
|
||||
- M107 - Fan off
|
||||
- M106 - Fan on (only if repurpose fan is enabled)
|
||||
- M107 - Fan off (only if repurpose fan is enabled)
|
||||
- M109 - Wait for extruder current temp to reach target temp.
|
||||
- M114 - Display current position
|
||||
|
||||
|
@ -77,7 +79,7 @@ Custom M Codes
|
|||
- M29 - Stop SD write
|
||||
- M30 <filename> - Delete file on sd card
|
||||
- M32 <dirname> create subdirectory
|
||||
- M42 P<pin number> S<value 0..255> - Change output of pin P to S. Does not work on most important pins.
|
||||
- M42 P<pin number> S<value 0..255> - Change output of pin P to S. Does not work on most important pins, if no S: read value of pin
|
||||
- M50 - Stop print from host or SD Card
|
||||
- M80 - Turn on power supply
|
||||
- M81 - Turn off power supply
|
||||
|
@ -86,7 +88,7 @@ Custom M Codes
|
|||
- M84 - Disable steppers until next move,
|
||||
or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
|
||||
- M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
|
||||
- M92 - Set axisStepsPerMM - same syntax as G92
|
||||
- M92 - Set axisStepsPerMM - same syntax as G1
|
||||
- M99 S<delayInSec> X0 Y0 Z0 - Disable motors for S seconds (default 10) for given axis.
|
||||
- M100 clean nozzle
|
||||
- M104 S<temp> T<extruder> P1 F1 - Set temperature without wait. P1 = wait for moves to finish, F1 = beep when temp. reached first time
|
||||
|
|
|
@ -167,7 +167,7 @@ STEPPER_CURRENT_CONTROL
|
|||
#define LED_PIN -1
|
||||
#define ORIG_FAN_PIN 9
|
||||
#define ORIG_FAN2_PIN 8
|
||||
#define ORIG_PS_ON_PIN 40
|
||||
#define ORIG_PS_ON_PIN -1//40
|
||||
#define KILL_PIN -1
|
||||
#define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing.
|
||||
|
||||
|
@ -293,6 +293,12 @@ STEPPER_CURRENT_CONTROL
|
|||
#if MOTHERBOARD == 999
|
||||
#define KNOWN_BOARD
|
||||
#include "userpins.h"
|
||||
#else
|
||||
#define LIGHT_PIN -1
|
||||
#define BADGE_LIGHT_PIN -1
|
||||
//#define TOP_SENSOR_PIN -1
|
||||
//#define FIL_SENSOR1_PIN -1
|
||||
//#define FIL_SENSOR2_PIN -1
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -326,31 +332,34 @@ STEPPER_CURRENT_CONTROL
|
|||
|
||||
// Available chip select pins for HW SPI are 4 10 52
|
||||
#if (SDSS == 4) || (SDSS == 10) || (SDSS == 52)
|
||||
#if (SDSS == 10)
|
||||
#define SPI_PIN 77
|
||||
#define SPI_CHAN 0
|
||||
#else
|
||||
#if (SDSS == 52)
|
||||
#define SPI_PIN 86
|
||||
#define SPI_CHAN 2
|
||||
#else // SDSS == 4
|
||||
#define SPI_PIN 87
|
||||
#define SPI_CHAN 1
|
||||
#endif
|
||||
#endif
|
||||
#if (SDSS == 10)
|
||||
#define SPI_PIN 77
|
||||
#define SPI_CHAN 0
|
||||
#else
|
||||
#if (SDSS == 52)
|
||||
#define SPI_PIN 86
|
||||
#define SPI_CHAN 2
|
||||
#else // SDSS == 4
|
||||
#define SPI_PIN 87
|
||||
#define SPI_CHAN 1
|
||||
#endif
|
||||
#endif
|
||||
#define MOSI_PIN 75
|
||||
#define MISO_PIN 74
|
||||
#define SCK_PIN 76
|
||||
//#define DUE_SOFTWARE_SPI
|
||||
//Davinci Specific, SD Card pins are defined in Userpins.h
|
||||
#elsif MOTHERBOARD != 999
|
||||
#define DUE_SOFTWARE_SPI
|
||||
#define MOSI_PIN 51
|
||||
#define MISO_PIN 50
|
||||
#define SCK_PIN 52
|
||||
#else
|
||||
#if MOTHERBOARD != 999
|
||||
#define DUE_SOFTWARE_SPI
|
||||
#define MOSI_PIN 51
|
||||
#define MISO_PIN 50
|
||||
#define SCK_PIN 52
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Original pin assignmats to be used in configuration tool
|
||||
#define X_STEP_PIN ORIG_X_STEP_PIN
|
||||
#define X_DIR_PIN ORIG_X_DIR_PIN
|
||||
|
|
|
@ -1517,10 +1517,12 @@ void UIDisplay::parse(const char *txt,bool ram)
|
|||
{
|
||||
addStringP(extruder[2].tempControl.targetTemperatureC>0?"\004":"\003");
|
||||
}
|
||||
#if HAVE_HEATED_BED
|
||||
else if(c2=='7') //Bed Off
|
||||
{
|
||||
addStringP(heatedBedController.targetTemperatureC>0?"\004":"\003");
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 'C':
|
||||
if(c2=='1')
|
||||
|
@ -1619,8 +1621,11 @@ void UIDisplay::parse(const char *txt,bool ram)
|
|||
break;
|
||||
#endif
|
||||
case 'f':
|
||||
if(c2 >= 'x' && c2 <= 'z') addFloat(Printer::maxFeedrate[c2 - 'x'], 5, 0);
|
||||
if(c2 >= 'x' && c2 <= 'z' && ! (c2 == 'l' || c2 == 'u' ||c2 == 'd')) addFloat(Printer::maxFeedrate[c2 - 'x'], 5, 0);
|
||||
else if(c2 >= 'X' && c2 <= 'Z') addFloat(Printer::homingFeedrate[c2 - 'X'], 5, 0);
|
||||
else if(c2 == 'l') addFloat(EEPROM::loading_feed_rate, 5, 0);
|
||||
else if(c2 == 'u') addFloat(EEPROM::unloading_feed_rate, 5, 0);
|
||||
else if(c2 == 'd') addFloat(EEPROM::unloading_loading_distance, 3, 0);
|
||||
break;
|
||||
//Davinci Specific, XYZ Min position
|
||||
case 'H':
|
||||
|
@ -1644,6 +1649,9 @@ void UIDisplay::parse(const char *txt,bool ram)
|
|||
break;
|
||||
case 'l':
|
||||
if(c2 == 'a') addInt(lastAction,4);
|
||||
#if defined(BADGE_LIGHT_PIN) && BADGE_LIGHT_PIN >= 0
|
||||
else if(c2 == 'b') addStringOnOff(READ(BADGE_LIGHT_PIN)); // Lights on/off
|
||||
#endif
|
||||
#if defined(CASE_LIGHTS_PIN) && CASE_LIGHTS_PIN >= 0
|
||||
else if(c2 == 'o') addStringOnOff(READ(CASE_LIGHTS_PIN)); // Lights on/off
|
||||
//Davinci Specific, Light management
|
||||
|
@ -1665,11 +1673,30 @@ void UIDisplay::parse(const char *txt,bool ram)
|
|||
else percent = (sd.sdpos >> 8) * 100.0 / (sd.filesize >> 8);
|
||||
addFloat(percent, 3, 1);
|
||||
if(col<MAX_COLS)
|
||||
{
|
||||
uid.printCols[col++] = '%';
|
||||
uid.printCols[col++] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
parse(statusMsg, true);
|
||||
//Davinci Wifi
|
||||
#if ENABLE_WIFI
|
||||
static char lastmsg[21]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
char currentmsg[21]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
if(HAL::bwifion)
|
||||
{
|
||||
strcpy(currentmsg,uid.printCols);
|
||||
//send only if different than previous and not empty
|
||||
if (strcmp(lastmsg,currentmsg)!=0 && strlen(statusMsg)>0)
|
||||
{
|
||||
strcpy(lastmsg,currentmsg);
|
||||
Com::print(Com::tStatus);
|
||||
Com::printFLN(currentmsg);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
if(c2 == 'c')
|
||||
|
@ -1781,38 +1808,44 @@ case 'P':
|
|||
if(c2 == 'x')
|
||||
{
|
||||
#if (X_MIN_PIN > -1) && MIN_HARDWARE_ENDSTOP_X
|
||||
addStringOnOff(Printer::isXMinEndstopHit());
|
||||
//addStringOnOff(Printer::isXMinEndstopHit());
|
||||
addStringP(Printer::isXMinEndstopHit()?"\003":"\004");
|
||||
#else
|
||||
addStringP(ui_text_na);
|
||||
#endif
|
||||
}
|
||||
if(c2 == 'X')
|
||||
#if (X_MAX_PIN > -1) && MAX_HARDWARE_ENDSTOP_X
|
||||
addStringOnOff(Printer::isXMaxEndstopHit());
|
||||
//addStringOnOff(Printer::isXMaxEndstopHit());
|
||||
addStringP(Printer::isXMaxEndstopHit()?"\003":"\004");
|
||||
#else
|
||||
addStringP(ui_text_na);
|
||||
#endif
|
||||
if(c2 == 'y')
|
||||
#if (Y_MIN_PIN > -1)&& MIN_HARDWARE_ENDSTOP_Y
|
||||
addStringOnOff(Printer::isYMinEndstopHit());
|
||||
//addStringOnOff(Printer::isYMinEndstopHit());
|
||||
addStringP(Printer::isYMinEndstopHit()?"\003":"\004");
|
||||
#else
|
||||
addStringP(ui_text_na);
|
||||
#endif
|
||||
if(c2 == 'Y')
|
||||
#if (Y_MAX_PIN > -1) && MAX_HARDWARE_ENDSTOP_Y
|
||||
addStringOnOff(Printer::isYMaxEndstopHit());
|
||||
//addStringOnOff(Printer::isYMaxEndstopHit());
|
||||
addStringP(Printer::isYMaxEndstopHit()?"\003":"\004");
|
||||
#else
|
||||
addStringP(ui_text_na);
|
||||
#endif
|
||||
if(c2 == 'z')
|
||||
#if (Z_MIN_PIN > -1) && MIN_HARDWARE_ENDSTOP_Z
|
||||
addStringOnOff(Printer::isZMinEndstopHit());
|
||||
//addStringOnOff(Printer::isZMinEndstopHit());
|
||||
addStringP(Printer::isZMinEndstopHit()?"\003":"\004");
|
||||
#else
|
||||
addStringP(ui_text_na);
|
||||
#endif
|
||||
if(c2=='Z')
|
||||
#if (Z_MAX_PIN > -1) && MAX_HARDWARE_ENDSTOP_Z
|
||||
addStringOnOff(Printer::isZMaxEndstopHit());
|
||||
//addStringOnOff(Printer::isZMaxEndstopHit());
|
||||
addStringP(Printer::isZMaxEndstopHit()?"\003":"\004");
|
||||
#else
|
||||
addStringP(ui_text_na);
|
||||
#endif
|
||||
|
@ -1870,6 +1903,11 @@ case 'P':
|
|||
}
|
||||
break;
|
||||
|
||||
#if ENABLE_WIFI
|
||||
case 'w':
|
||||
if(c2=='o')addStringP(HAL::bwifion?ui_text_on:ui_text_off); //wifi on/off
|
||||
break;
|
||||
#endif
|
||||
case 'x':
|
||||
if(c2>='0' && c2<='4')
|
||||
{
|
||||
|
@ -2031,7 +2069,7 @@ void UIDisplay::setStatusP(PGM_P txt,bool error)
|
|||
}
|
||||
statusMsg[i]=0;
|
||||
if(error)
|
||||
Printer::setUIErrorMessage(true);
|
||||
Printer::setUIErrorMessage(true);
|
||||
}
|
||||
void UIDisplay::setStatus(const char *txt,bool error)
|
||||
{
|
||||
|
@ -3248,8 +3286,10 @@ bool UIDisplay::nextPreviousAction(int16_t next, bool allowMoves)
|
|||
if (action==UI_ACTION_Z_1)istep=1;
|
||||
if (action==UI_ACTION_Z_10)istep=10;
|
||||
if (action==UI_ACTION_Z_100)istep=100;
|
||||
#if !FEATURE_ENCODER
|
||||
increment=-increment; //upside down increment to allow keys to follow Z movement, Up Key make Z going up, down key make Z going down
|
||||
if (!Printer::isZHomed())//ask for home to secure movement
|
||||
#endif
|
||||
if (!Printer::isZHomed())//ask for home to secure movement
|
||||
{
|
||||
if (confirmationDialog(UI_TEXT_DO_YOU ,UI_TEXT_HOME_Z,UI_TEXT_WARNING_POS_Z_UNKNOWN,UI_CONFIRMATION_TYPE_YES_NO,true))
|
||||
{
|
||||
|
@ -3274,10 +3314,12 @@ bool UIDisplay::nextPreviousAction(int16_t next, bool allowMoves)
|
|||
int istep=1;
|
||||
if (action==UI_ACTION_E_10)istep=10;
|
||||
if (action==UI_ACTION_E_100)istep=100;
|
||||
#if !FEATURE_ENCODER
|
||||
increment=-increment; //upside down increment to allow keys to follow filament movement, Up Key make filament going up, down key make filament going down
|
||||
#endif
|
||||
if(reportTempsensorError() or Printer::debugDryrun()) break;
|
||||
//check temperature
|
||||
if(Extruder::current->tempControl.currentTemperatureC<=MIN_EXTRUDER_TEMP)
|
||||
if(Extruder::current->tempControl.currentTemperatureC<=MIN_EXTRUDER_TEMP && !Printer::isColdExtrusionAllowed())
|
||||
{
|
||||
if (confirmationDialog(UI_TEXT_WARNING ,UI_TEXT_EXTRUDER_COLD,UI_TEXT_HEAT_EXTRUDER,UI_CONFIRMATION_TYPE_YES_NO,true))
|
||||
{
|
||||
|
@ -3433,6 +3475,15 @@ case UI_ACTION_BED_TEMP_PLA :
|
|||
INCREMENT_MIN_MAX(Printer::maxZJerk,0.1,0.1,99.9);
|
||||
break;
|
||||
#endif
|
||||
case UI_ACTION_LOADING_FEEDRATE:
|
||||
INCREMENT_MIN_MAX(EEPROM::loading_feed_rate, 1, 1, 1000);
|
||||
break;
|
||||
case UI_ACTION_UNLOADING_FEEDRATE:
|
||||
INCREMENT_MIN_MAX(EEPROM::unloading_feed_rate, 1, 1, 1000);
|
||||
break;
|
||||
case UI_ACTION_LOAD_UNLOAD_DISTANCE:
|
||||
INCREMENT_MIN_MAX(EEPROM::unloading_loading_distance, 1, 1, 1000);
|
||||
break;
|
||||
case UI_ACTION_HOMING_FEEDRATE_X:
|
||||
case UI_ACTION_HOMING_FEEDRATE_Y:
|
||||
case UI_ACTION_HOMING_FEEDRATE_Z:
|
||||
|
@ -3596,6 +3647,9 @@ bool UIDisplay::confirmationDialog(char * title,char * line1,char * line2,int ty
|
|||
{
|
||||
bool response=defaultresponse;
|
||||
bool process_it=true;
|
||||
#if FEATURE_ENCODER
|
||||
bool encoder_command=false;
|
||||
#endif
|
||||
int previousaction=0;
|
||||
int tmpmenulevel = menuLevel;
|
||||
if (menuLevel>3)menuLevel=3;
|
||||
|
@ -3631,6 +3685,20 @@ while (process_it)
|
|||
//process critical actions
|
||||
Commands::checkForPeriodicalActions(true);
|
||||
//be sure button is pressed and not same one
|
||||
#if FEATURE_ENCODER
|
||||
int16_t encodeChange = encoderPos;
|
||||
encoderPos = 0;
|
||||
if (encodeChange > 0 )
|
||||
{
|
||||
encoder_command=true;
|
||||
lastButtonAction=UI_ACTION_BACK;
|
||||
}
|
||||
if (encodeChange < 0 )
|
||||
{
|
||||
encoder_command=true;
|
||||
lastButtonAction=UI_ACTION_RIGHT_KEY;
|
||||
}
|
||||
#endif
|
||||
if (lastButtonAction!=previousaction)
|
||||
{
|
||||
previousaction=lastButtonAction;
|
||||
|
@ -3645,6 +3713,12 @@ while (process_it)
|
|||
TOGGLE(CASE_LIGHTS_PIN);
|
||||
}
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > 0
|
||||
if (!(READ(BADGE_LIGHT_PIN)) && EEPROM::busebadgelight && EEPROM::buselight)
|
||||
{
|
||||
TOGGLE(BADGE_LIGHT_PIN);
|
||||
}
|
||||
#endif
|
||||
#if defined(UI_BACKLIGHT_PIN)
|
||||
if (!(READ(UI_BACKLIGHT_PIN))) WRITE(UI_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
@ -3669,6 +3743,13 @@ while (process_it)
|
|||
}
|
||||
if(previousaction!=0)BEEP_SHORT;
|
||||
refreshPage();
|
||||
#if FEATURE_ENCODER
|
||||
if (encoder_command)
|
||||
{
|
||||
lastButtonAction=0;
|
||||
encoder_command=false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}//end while
|
||||
menuLevel=tmpmenulevel;
|
||||
|
@ -3709,6 +3790,12 @@ int UIDisplay::executeAction(int action, bool allowMoves)
|
|||
TOGGLE(CASE_LIGHTS_PIN);
|
||||
}
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > 0
|
||||
if (!(READ(BADGE_LIGHT_PIN)) && EEPROM::buselight && EEPROM::busebadgelight)
|
||||
{
|
||||
TOGGLE(BADGE_LIGHT_PIN);
|
||||
}
|
||||
#endif
|
||||
#if defined(UI_BACKLIGHT_PIN)
|
||||
if (!(READ(UI_BACKLIGHT_PIN)))WRITE(UI_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
@ -3945,6 +4032,14 @@ int UIDisplay::executeAction(int action, bool allowMoves)
|
|||
EEPROM:: update(EPR_FIL_SENSOR_ON,EPR_TYPE_BYTE,EEPROM::busesensor,0);
|
||||
UI_STATUS(UI_TEXT_FIL_SENSOR_ONOFF);
|
||||
break;
|
||||
#endif
|
||||
#if ENABLE_WIFI
|
||||
case UI_ACTION_WIFI_ONOFF:
|
||||
HAL::bwifion=!HAL::bwifion;
|
||||
//save directly to eeprom
|
||||
EEPROM:: update(EPR_WIFI_ON,EPR_TYPE_BYTE,HAL::bwifion,0);
|
||||
UI_STATUS(UI_TEXT_WIFI_ONOFF);
|
||||
break;
|
||||
#endif
|
||||
#if defined(TOP_SENSOR_PIN)
|
||||
case UI_ACTION_TOP_SENSOR_ONOFF:
|
||||
|
@ -3968,6 +4063,19 @@ int UIDisplay::executeAction(int action, bool allowMoves)
|
|||
UI_STATUS(UI_TEXT_LIGHTS_ONOFF);
|
||||
break;
|
||||
#endif
|
||||
//Davinci Specific, save state to EEPROM
|
||||
#if BADGE_LIGHT_PIN > -1
|
||||
case UI_ACTION_BADGE_LIGHT_ONOFF:
|
||||
TOGGLE(BADGE_LIGHT_PIN);
|
||||
if (READ(BADGE_LIGHT_PIN))
|
||||
EEPROM::busebadgelight=true;
|
||||
else
|
||||
EEPROM::busebadgelight=false;
|
||||
//save directly to eeprom
|
||||
EEPROM:: update(EPR_BADGE_LIGHT_ON,EPR_TYPE_BYTE,EEPROM::busebadgelight,0);
|
||||
UI_STATUS(UI_TEXT_BADGE_LIGHT_ONOFF);
|
||||
break;
|
||||
#endif
|
||||
//Davinci Specific
|
||||
case UI_ACTION_LOAD_FAILSAFE:
|
||||
EEPROM::restoreEEPROMSettingsFromConfiguration();
|
||||
|
@ -3981,6 +4089,39 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
else UI_STATUS(UI_TEXT_LOAD_FAILSAFE);
|
||||
//skipBeep = true;
|
||||
break;
|
||||
case UI_ACTION_BED_DOWN:
|
||||
{
|
||||
if(!allowMoves) return UI_ACTION_BED_DOWN;
|
||||
int tmpmenu=menuLevel;
|
||||
int tmpmenupos=menuPos[menuLevel];
|
||||
UIMenu *tmpmen = (UIMenu*)menu[menuLevel];
|
||||
if (!Printer::isZHomed())//ask for home to secure movement
|
||||
{
|
||||
if (confirmationDialog(UI_TEXT_DO_YOU ,UI_TEXT_HOME_Z,UI_TEXT_WARNING_POS_Z_UNKNOWN,UI_CONFIRMATION_TYPE_YES_NO,true))
|
||||
{
|
||||
executeAction(UI_ACTION_HOME_Z,true);
|
||||
}
|
||||
}
|
||||
if(Printer::isZHomed())//check if accepted to home
|
||||
{
|
||||
menuLevel=0;
|
||||
menuPos[0] = 0;
|
||||
refreshPage();
|
||||
UI_STATUS(UI_TEXT_PLEASE_WAIT);
|
||||
Printer::lastCmdPos[Z_AXIS]=Printer::zMin+Printer::zMin+Printer::zLength;
|
||||
Printer::moveToReal(IGNORE_COORDINATE,IGNORE_COORDINATE,Printer::zMin+Printer::zMin+Printer::zLength,IGNORE_COORDINATE,Printer::homingFeedrate[Z_AXIS]);
|
||||
Printer::updateCurrentPosition();
|
||||
Commands::waitUntilEndOfAllMoves();
|
||||
Commands::printCurrentPosition(PSTR("UI_ACTION_ZPOSITION "));
|
||||
UI_STATUS(UI_TEXT_BED_DOWN);
|
||||
}
|
||||
Printer::setMenuMode(MENU_MODE_PRINTING,false);
|
||||
menuLevel=tmpmenu;
|
||||
menuPos[menuLevel]=tmpmenupos;
|
||||
menu[menuLevel]=tmpmen;
|
||||
refreshPage();
|
||||
}
|
||||
break;
|
||||
#if ENABLE_CLEAN_NOZZLE==1
|
||||
case UI_ACTION_CLEAN_NOZZLE:
|
||||
{//be sure no issue
|
||||
|
@ -4067,8 +4208,17 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
//just need to wait for key to be pressed
|
||||
break;
|
||||
}
|
||||
#if FEATURE_ENCODER
|
||||
//check encoder
|
||||
int16_t encodeChange = encoderPos;
|
||||
bool encoder_command=false;
|
||||
if (encodeChange > 0 ) encoder_command=true;
|
||||
encoderPos = 0;
|
||||
//check what key is pressed
|
||||
if (previousaction!=lastButtonAction)
|
||||
if (previousaction!=lastButtonAction || encoder_command)
|
||||
#else
|
||||
if (previousaction!=lastButtonAction)
|
||||
#endif
|
||||
{
|
||||
previousaction=lastButtonAction;
|
||||
if(previousaction!=0)BEEP_SHORT;
|
||||
|
@ -4079,8 +4229,12 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
playsound(3000,240);
|
||||
Printer::homeAxis(true,true,false);
|
||||
}
|
||||
if (lastButtonAction==UI_ACTION_BACK)//this means user want to cancel current action
|
||||
{
|
||||
#if FEATURE_ENCODER
|
||||
if (lastButtonAction==UI_ACTION_BACK || encodeChange > 0)//this means user want to cancel current action
|
||||
#else
|
||||
if (lastButtonAction==UI_ACTION_BACK)//this means user want to cancel current action
|
||||
#endif
|
||||
{
|
||||
if (confirmationDialog(UI_TEXT_PLEASE_CONFIRM ,UI_TEXT_CANCEL_ACTION,UI_TEXT_CLEANING_NOZZLE))
|
||||
{
|
||||
UI_STATUS(UI_TEXT_CANCELED);
|
||||
|
@ -4105,6 +4259,12 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
TOGGLE(CASE_LIGHTS_PIN);
|
||||
}
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > 0
|
||||
if (!(READ(BADGE_LIGHT_PIN)) && EEPROM::busebadgelight && EEPROM::buselight)
|
||||
{
|
||||
TOGGLE(BADGE_LIGHT_PIN);
|
||||
}
|
||||
#endif
|
||||
#if defined(UI_BACKLIGHT_PIN)
|
||||
if (!(READ(UI_BACKLIGHT_PIN))) WRITE(UI_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
@ -4239,6 +4399,12 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
TOGGLE(CASE_LIGHTS_PIN);
|
||||
}
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > 0
|
||||
if (!(READ(BADGE_LIGHT_PIN)) && EEPROM::busebadgelight && EEPROM::buselight)
|
||||
{
|
||||
TOGGLE(BADGE_LIGHT_PIN);
|
||||
}
|
||||
#endif
|
||||
#if defined(UI_BACKLIGHT_PIN)
|
||||
if (!(READ(UI_BACKLIGHT_PIN))) WRITE(UI_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
@ -4275,6 +4441,8 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
{
|
||||
Com::printFLN(PSTR("RequestPause: No Filament!"));
|
||||
Commands::waitUntilEndOfAllMoves();
|
||||
Printer::moveToReal(IGNORE_COORDINATE,IGNORE_COORDINATE,Printer::currentPositionSteps[Z_AXIS]+10,IGNORE_COORDINATE,Printer::homingFeedrate[Z_AXIS]);
|
||||
Printer::moveToReal(Printer::xMin,Printer::yMin,IGNORE_COORDINATE,IGNORE_COORDINATE,Printer::homingFeedrate[0]);
|
||||
}
|
||||
|
||||
//to be sure no return menu
|
||||
|
@ -4314,6 +4482,12 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
TOGGLE(CASE_LIGHTS_PIN);
|
||||
}
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > 0
|
||||
if (!(READ(BADGE_LIGHT_PIN)) && EEPROM::busebadgelight && EEPROM::buselight)
|
||||
{
|
||||
TOGGLE(BADGE_LIGHT_PIN);
|
||||
}
|
||||
#endif
|
||||
#if defined(UI_BACKLIGHT_PIN)
|
||||
if (!(READ(UI_BACKLIGHT_PIN))) WRITE(UI_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
@ -4488,7 +4662,7 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
if (load_dir==-1)
|
||||
{
|
||||
UI_STATUS(UI_TEXT_UNLOADING_FILAMENT);
|
||||
PrintLine::moveRelativeDistanceInSteps(0,0,0,load_dir * Printer::axisStepsPerMM[E_AXIS],4,false,false);
|
||||
PrintLine::moveRelativeDistanceInSteps(0,0,0,load_dir * Printer::axisStepsPerMM[E_AXIS],EEPROM::unloading_feed_rate,false,false);
|
||||
if (extruderid==0)//filament sensor override to stop earlier
|
||||
{
|
||||
#if defined(FIL_SENSOR1_PIN)
|
||||
|
@ -4511,14 +4685,18 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
else
|
||||
{
|
||||
UI_STATUS(UI_TEXT_LOADING_FILAMENT);
|
||||
PrintLine::moveRelativeDistanceInSteps(0,0,0,load_dir * Printer::axisStepsPerMM[E_AXIS],2,false,false);
|
||||
PrintLine::moveRelativeDistanceInSteps(0,0,0,load_dir * Printer::axisStepsPerMM[E_AXIS],EEPROM::loading_feed_rate,false,false);
|
||||
}
|
||||
if (counter>=60)step = STEP_EXT_ASK_CONTINUE;
|
||||
if (counter>=EEPROM::unloading_loading_distance)step = STEP_EXT_ASK_CONTINUE;
|
||||
}
|
||||
break;
|
||||
case STEP_EXT_ASK_CONTINUE:
|
||||
if(!PrintLine::hasLines())
|
||||
{
|
||||
#if FEATURE_RETRACTION
|
||||
if (load_dir==1)
|
||||
Extruder::current->retractDistance(EEPROM_FLOAT(RETRACTION_LENGTH));
|
||||
#endif
|
||||
//ask to redo or stop
|
||||
if (confirmationDialog(UI_TEXT_PLEASE_CONFIRM ,UI_TEXT_CONTINUE_ACTION,UI_TEXT_PUSH_FILAMENT,UI_CONFIRMATION_TYPE_YES_NO,true))
|
||||
{
|
||||
|
@ -4535,8 +4713,17 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
}
|
||||
break;
|
||||
}
|
||||
#if FEATURE_ENCODER
|
||||
//check encoder
|
||||
int16_t encodeChange = encoderPos;
|
||||
bool encoder_command=false;
|
||||
if (encodeChange > 0 ) encoder_command=true;
|
||||
encoderPos = 0;
|
||||
//check what key is pressed
|
||||
if (previousaction!=lastButtonAction)
|
||||
if (previousaction!=lastButtonAction || encoder_command)
|
||||
#else
|
||||
if (previousaction!=lastButtonAction)
|
||||
#endif
|
||||
{
|
||||
previousaction=lastButtonAction;
|
||||
if(previousaction!=0)BEEP_SHORT;
|
||||
|
@ -4547,7 +4734,11 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
playsound(3000,240);
|
||||
UI_STATUS(UI_TEXT_PUSH_FILAMENT);
|
||||
}
|
||||
if (lastButtonAction==UI_ACTION_BACK)//this means user want to cancel current action
|
||||
#if FEATURE_ENCODER
|
||||
if (lastButtonAction==UI_ACTION_BACK || encodeChange > 0)//this means user want to cancel current action
|
||||
#else
|
||||
if (lastButtonAction==UI_ACTION_BACK)//this means user want to cancel current action
|
||||
#endif
|
||||
{
|
||||
if (confirmationDialog(UI_TEXT_PLEASE_CONFIRM ,UI_TEXT_CANCEL_ACTION,UI_TEXT_LOADUNLOAD_FILAMENT))
|
||||
{
|
||||
|
@ -4573,6 +4764,12 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
TOGGLE(CASE_LIGHTS_PIN);
|
||||
}
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > 0
|
||||
if (!(READ(BADGE_LIGHT_PIN)) && EEPROM::busebadgelight && EEPROM::buselight)
|
||||
{
|
||||
TOGGLE(BADGE_LIGHT_PIN);
|
||||
}
|
||||
#endif
|
||||
#if defined(UI_BACKLIGHT_PIN)
|
||||
if (!(READ(UI_BACKLIGHT_PIN))) WRITE(UI_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
@ -4857,8 +5054,17 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
else process_it=false;
|
||||
break;
|
||||
}
|
||||
#if FEATURE_ENCODER
|
||||
//check encoder
|
||||
int16_t encodeChange = encoderPos;
|
||||
bool encoder_command=false;
|
||||
if (encodeChange > 0 ) encoder_command=true;
|
||||
encoderPos = 0;
|
||||
//check what key is pressed
|
||||
if (previousaction!=lastButtonAction)
|
||||
if (previousaction!=lastButtonAction || encoder_command)
|
||||
#else
|
||||
if (previousaction!=lastButtonAction)
|
||||
#endif
|
||||
{
|
||||
previousaction=lastButtonAction;
|
||||
if(previousaction!=0)BEEP_SHORT;
|
||||
|
@ -4866,7 +5072,11 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
{
|
||||
step=STEP_AUTOLEVEL_SAVE_RESULTS;
|
||||
}
|
||||
if (lastButtonAction==UI_ACTION_BACK)//this means user want to cancel current action
|
||||
#if FEATURE_ENCODER
|
||||
if (lastButtonAction==UI_ACTION_BACK || encodeChange > 0)//this means user want to cancel current action
|
||||
#else
|
||||
if (lastButtonAction==UI_ACTION_BACK)//this means user want to cancel current action
|
||||
#endif
|
||||
{
|
||||
if (confirmationDialog(UI_TEXT_PLEASE_CONFIRM ,UI_TEXT_CANCEL_ACTION,UI_TEXT_AUTOLEVEL))
|
||||
{
|
||||
|
@ -4894,6 +5104,12 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
TOGGLE(CASE_LIGHTS_PIN);
|
||||
}
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > 0
|
||||
if (!(READ(BADGE_LIGHT_PIN)) && EEPROM::busebadgelight && EEPROM::buselight)
|
||||
{
|
||||
TOGGLE(BADGE_LIGHT_PIN);
|
||||
}
|
||||
#endif
|
||||
#if defined(UI_BACKLIGHT_PIN)
|
||||
if (!(READ(UI_BACKLIGHT_PIN))) WRITE(UI_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
@ -5130,8 +5346,17 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
step =STEP_MANUAL_LEVEL_PAGE10;
|
||||
break;
|
||||
}
|
||||
#if FEATURE_ENCODER
|
||||
//check encoder
|
||||
int16_t encodeChange = encoderPos;
|
||||
bool encoder_command=false;
|
||||
if (encodeChange > 0 ) encoder_command=true;
|
||||
encoderPos = 0;
|
||||
//check what key is pressed
|
||||
if (previousaction!=lastButtonAction)
|
||||
if (previousaction!=lastButtonAction || encoder_command)
|
||||
#else
|
||||
if (previousaction!=lastButtonAction)
|
||||
#endif
|
||||
{
|
||||
previousaction=lastButtonAction;
|
||||
if(previousaction!=0)BEEP_SHORT;
|
||||
|
@ -5198,7 +5423,11 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
process_it=false;
|
||||
}
|
||||
}
|
||||
else if (lastButtonAction==UI_ACTION_BACK)//this means user want to cancel current action
|
||||
#if FEATURE_ENCODER
|
||||
else if (lastButtonAction==UI_ACTION_BACK || encodeChange > 0)//this means user want to cancel current action
|
||||
#else
|
||||
else if (lastButtonAction==UI_ACTION_BACK)//this means user want to cancel current action
|
||||
#endif
|
||||
{
|
||||
if (confirmationDialog(UI_TEXT_PLEASE_CONFIRM ,UI_TEXT_CANCEL_ACTION,UI_TEXT_MANUAL_LEVEL))
|
||||
{
|
||||
|
@ -5239,6 +5468,12 @@ case UI_ACTION_LOAD_FAILSAFE:
|
|||
TOGGLE(CASE_LIGHTS_PIN);
|
||||
}
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > 0
|
||||
if (!(READ(BADGE_LIGHT_PIN)) && EEPROM::busebadgelight && EEPROM::buselight)
|
||||
{
|
||||
TOGGLE(BADGE_LIGHT_PIN);
|
||||
}
|
||||
#endif
|
||||
#if defined(UI_BACKLIGHT_PIN)
|
||||
if (!(READ(UI_BACKLIGHT_PIN))) WRITE(UI_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
@ -6038,6 +6273,12 @@ if ((ui_autolightoff_time<time) && (EEPROM::timepowersaving>0) )
|
|||
TOGGLE(CASE_LIGHTS_PIN);
|
||||
}
|
||||
#endif
|
||||
#if BADGE_LIGHT_PIN > 0
|
||||
if ((READ(BADGE_LIGHT_PIN)) && EEPROM::busebadgelight && EEPROM::buselight)
|
||||
{
|
||||
TOGGLE(BADGE_LIGHT_PIN);
|
||||
}
|
||||
#endif
|
||||
#if defined(UI_BACKLIGHT_PIN)
|
||||
WRITE(UI_BACKLIGHT_PIN, LOW);
|
||||
#endif
|
||||
|
|
|
@ -256,12 +256,18 @@ What display type do you use?
|
|||
#define UI_ACTION_Z_LENGTH 1535
|
||||
#define UI_ACTION_VERSION 1536
|
||||
#define UI_ACTION_TOP_SENSOR_ONOFF 1537
|
||||
#define UI_ACTION_WIFI_ONOFF 1538
|
||||
#define UI_ACTION_Z_0_1 1539
|
||||
#define UI_ACTION_X_MIN 1540
|
||||
#define UI_ACTION_Y_MIN 1541
|
||||
#define UI_ACTION_Z_MIN 1542
|
||||
#define UI_ACTION_TOGGLE_POWERSAVE 1543
|
||||
#define UI_ACTION_STOP_PRINTING_FROM_MENU 1544
|
||||
#define UI_ACTION_BED_DOWN 1545
|
||||
#define UI_ACTION_BADGE_LIGHT_ONOFF 1546
|
||||
#define UI_ACTION_LOADING_FEEDRATE 1547
|
||||
#define UI_ACTION_UNLOADING_FEEDRATE 1548
|
||||
#define UI_ACTION_LOAD_UNLOAD_DISTANCE 1549
|
||||
|
||||
#define UI_ACTION_MENU_XPOS 4000
|
||||
#define UI_ACTION_MENU_YPOS 4001
|
||||
|
@ -499,15 +505,22 @@ extern const int8_t encoder_table[16] PROGMEM ;
|
|||
#endif
|
||||
#define UI_MENU_MAXLEVEL 5
|
||||
|
||||
#ifndef UI_ROWS
|
||||
#define UI_ROWS 4
|
||||
#endif
|
||||
|
||||
#define UI_FLAG_FAST_KEY_ACTION 1
|
||||
#define UI_FLAG_SLOW_KEY_ACTION 2
|
||||
#define UI_FLAG_SLOW_ACTION_RUNNING 4
|
||||
#define UI_FLAG_KEY_TEST_RUNNING 8
|
||||
/*Davinci Specific, to track any not obvious change, class definition stay in comment
|
||||
and used one is located at the end of the file
|
||||
|
||||
//Davinci Specific,move to the end to integrate SDrefresh in class
|
||||
class UIDisplay {
|
||||
public:
|
||||
#if UI_AUTOLIGHTOFF_AFTER!=0
|
||||
static millis_t ui_autolightoff_time;
|
||||
#endif
|
||||
static uint8_t display_mode;
|
||||
volatile uint8_t flags; // 1 = fast key action, 2 = slow key action, 4 = slow action running, 8 = key test running
|
||||
uint8_t col; // current col for buffer prefill
|
||||
uint8_t menuLevel; // current menu level, 0 = info, 1 = group, 2 = groupdata select, 3 = value change
|
||||
|
@ -541,6 +554,7 @@ class UIDisplay {
|
|||
void addStringOnOff(uint8_t);
|
||||
void addChar(const char c);
|
||||
void addGCode(GCode *code);
|
||||
|
||||
int okAction(bool allowMoves);
|
||||
bool nextPreviousAction(int16_t next, bool allowMoves);
|
||||
char statusMsg[21];
|
||||
|
@ -559,6 +573,7 @@ class UIDisplay {
|
|||
void slowAction(bool allowMoves);
|
||||
void fastAction();
|
||||
void mediumAction();
|
||||
bool confirmationDialog(char * title,char * line1,char * line2,int type=UI_CONFIRMATION_TYPE_YES_NO, bool defaultresponse=false);
|
||||
void pushMenu(const UIMenu *men, bool refresh);
|
||||
void popMenu(bool refresh);
|
||||
void adjustMenuPos();
|
||||
|
@ -567,13 +582,15 @@ class UIDisplay {
|
|||
inline void setOutputMaskBits(unsigned int bits) {outputMask |= bits;}
|
||||
inline void unsetOutputMaskBits(unsigned int bits) {outputMask &= ~bits;}
|
||||
void updateSDFileCount();
|
||||
void sdrefresh(uint16_t &r,char cache[UI_ROWS][MAX_COLS+1]);
|
||||
void goDir(char *name);
|
||||
bool isDirname(char *name);
|
||||
bool isWizardActive();
|
||||
char cwd[SD_MAX_FOLDER_DEPTH*LONG_FILENAME_LENGTH+2];
|
||||
uint8_t folderLevel;
|
||||
};
|
||||
*/
|
||||
|
||||
extern UIDisplay uid;
|
||||
|
||||
#if FEATURE_CONTROLLER == UICONFIG_CONTROLLER
|
||||
#include "uiconfig.h"
|
||||
|
@ -1529,82 +1546,7 @@ void uiCheckSlowKeys(int &action) {}
|
|||
#define BEEP_LONG beep(BEEPER_LONG_SEQUENCE);
|
||||
#endif
|
||||
|
||||
//Davinci Specific,move to the end to integrate SDrefresh in class
|
||||
class UIDisplay {
|
||||
public:
|
||||
#if UI_AUTOLIGHTOFF_AFTER!=0
|
||||
static millis_t ui_autolightoff_time;
|
||||
#endif
|
||||
static uint8_t display_mode;
|
||||
volatile uint8_t flags; // 1 = fast key action, 2 = slow key action, 4 = slow action running, 8 = key test running
|
||||
uint8_t col; // current col for buffer prefill
|
||||
uint8_t menuLevel; // current menu level, 0 = info, 1 = group, 2 = groupdata select, 3 = value change
|
||||
uint16_t menuPos[UI_MENU_MAXLEVEL]; // Positions in menu
|
||||
const UIMenu *menu[UI_MENU_MAXLEVEL]; // Menus active
|
||||
uint16_t menuTop[UI_MENU_MAXLEVEL]; // Top row in menu
|
||||
int8_t shift; // Display shift for scrolling text
|
||||
int pageDelay; // Counter. If 0 page is refreshed if menuLevel is 0.
|
||||
void *errorMsg;
|
||||
uint16_t activeAction; // action for ok/next/previous
|
||||
uint16_t lastAction;
|
||||
uint16_t delayedAction;
|
||||
millis_t lastSwitch; // Last time display switched pages
|
||||
millis_t lastRefresh;
|
||||
uint16_t lastButtonAction;
|
||||
millis_t lastButtonStart;
|
||||
millis_t nextRepeat; // Time of next autorepeat
|
||||
millis_t lastNextPrev; // for increasing speed settings
|
||||
float lastNextAccumul; // Accumulated value
|
||||
unsigned int outputMask; // Output mask for backlight, leds etc.
|
||||
int repeatDuration; // Time beween to actions if autorepeat is enabled
|
||||
int8_t oldMenuLevel;
|
||||
uint8_t encoderStartScreen;
|
||||
char printCols[MAX_COLS+1];
|
||||
void addInt(int value,uint8_t digits,char fillChar=' '); // Print int into printCols
|
||||
void addLong(long value,char digits);
|
||||
inline void addLong(long value) {addLong(value, -11);};
|
||||
void addFloat(float number, char fixdigits,uint8_t digits);
|
||||
inline void addFloat(float number) {addFloat(number, -9,2);};
|
||||
void addStringP(PGM_P text);
|
||||
void addStringOnOff(uint8_t);
|
||||
void addChar(const char c);
|
||||
void addGCode(GCode *code);
|
||||
|
||||
int okAction(bool allowMoves);
|
||||
bool nextPreviousAction(int16_t next, bool allowMoves);
|
||||
char statusMsg[21];
|
||||
int8_t encoderPos;
|
||||
int8_t encoderLast;
|
||||
UIDisplay();
|
||||
void createChar(uint8_t location, const uint8_t charmap[]);
|
||||
void initialize(); // Initialize display and keys
|
||||
void waitForKey();
|
||||
void printRow(uint8_t r, char *txt, char *txt2, uint8_t changeAtCol); // Print row on display
|
||||
void printRowP(uint8_t r,PGM_P txt);
|
||||
void parse(const char *txt,bool ram); /// Parse output and write to printCols;
|
||||
void refreshPage();
|
||||
int executeAction(int action, bool allowMoves);
|
||||
void finishAction(int action);
|
||||
void slowAction(bool allowMoves);
|
||||
void fastAction();
|
||||
void mediumAction();
|
||||
bool confirmationDialog(char * title,char * line1,char * line2,int type=UI_CONFIRMATION_TYPE_YES_NO, bool defaultresponse=false);
|
||||
void pushMenu(const UIMenu *men, bool refresh);
|
||||
void popMenu(bool refresh);
|
||||
void adjustMenuPos();
|
||||
void setStatusP(PGM_P txt, bool error = false);
|
||||
void setStatus(const char *txt, bool error = false);
|
||||
inline void setOutputMaskBits(unsigned int bits) {outputMask |= bits;}
|
||||
inline void unsetOutputMaskBits(unsigned int bits) {outputMask &= ~bits;}
|
||||
void updateSDFileCount();
|
||||
void sdrefresh(uint16_t &r,char cache[UI_ROWS][MAX_COLS+1]);
|
||||
void goDir(char *name);
|
||||
bool isDirname(char *name);
|
||||
bool isWizardActive();
|
||||
char cwd[SD_MAX_FOLDER_DEPTH*LONG_FILENAME_LENGTH+2];
|
||||
uint8_t folderLevel;
|
||||
};
|
||||
extern UIDisplay uid;
|
||||
|
||||
extern void playsound(int tone,int duration);
|
||||
|
||||
extern void beep(uint8_t duration,uint8_t count);
|
||||
|
|
|
@ -420,6 +420,7 @@ inline void uiCheckSlowEncoder() {
|
|||
UI_KEYS_I2C_CLICKENCODER_LOW_REV(_BV(2),_BV(0)); // click encoder on pins 0 and 2. Phase is connected with gnd for signals.
|
||||
#endif
|
||||
}
|
||||
|
||||
void uiCheckSlowKeys(int &action) {
|
||||
#if defined(UI_HAS_I2C_KEYS) && UI_HAS_KEYS!=0
|
||||
#if UI_DISPLAY_I2C_CHIPTYPE==0
|
||||
|
|
|
@ -114,6 +114,11 @@
|
|||
#define UI_TEXT_EXTR_XOFF "Xoffst:%Xx"
|
||||
#define UI_TEXT_EXTR_YOFF "Yoffst:%Xy"
|
||||
#endif
|
||||
#define UI_TEXT_FEED_LOADING_FILAMENT "Load Fil.:%fl"
|
||||
#define UI_TEXT_FEED_UNLOADING_FILAMENT "Unload F.:%fu"
|
||||
#define UI_TEXT_LOADING_UNLOADING_DISTANCE "Load dist.: %fd"
|
||||
#define UI_TEXT_BED_DOWN "Bed Down"
|
||||
#define UI_TEXT_WIFI_ONOFF "Wifi: %wo"
|
||||
#define UI_TEXT_REDO_ACTION "Do it again ?"
|
||||
#define UI_TEXT_X_LENGTH "X Length:%Lxmm"
|
||||
#define UI_TEXT_Y_LENGTH "Y Length:%Lymm"
|
||||
|
@ -156,7 +161,7 @@
|
|||
#define UI_TEXT_BED "Bed"
|
||||
#define UI_TEXT_BED_OFF "SwitchOff Bed %B7"
|
||||
#define UI_TEXT_LIGHT_OFF_AFTER "Light AutoOff "
|
||||
#define UI_TEXT_LIGHT_OFF_AFTER2 "Dis. After:%il","[ms] 0=Off"
|
||||
#define UI_TEXT_LIGHT_OFF_AFTER2 "Dis. After:%il","[min] 0=Off"
|
||||
#define UI_TEXT_WARNING_POS_X_UNKNOWN "Real X unknown !"
|
||||
#define UI_TEXT_WARNING_POS_Y_UNKNOWN "Real Y unknown !"
|
||||
#define UI_TEXT_WARNING_POS_Z_UNKNOWN "Real Z unknown !"
|
||||
|
@ -206,6 +211,7 @@
|
|||
#define UI_TEXT_PREHEAT_PLA "Preheat PLA %B1"
|
||||
#define UI_TEXT_PREHEAT_ABS "Preheat ABS %B2"
|
||||
#define UI_TEXT_LIGHTS_ONOFF "Lights: %lo"
|
||||
#define UI_TEXT_BADGE_LIGHT_ONOFF "Badge light:%lb"
|
||||
#define UI_TEXT_SOUND_ONOF "Sound: %so"
|
||||
#define UI_TEXT_CONFIRMATION "%C1","%C2","%C3","%C4"
|
||||
#define UI_TEXT_YES_SELECTED " [Yes] No "
|
||||
|
@ -1350,6 +1356,7 @@
|
|||
// *************** French translation ****************
|
||||
// *************** By Doudou ****************
|
||||
#if UI_LANGUAGE==7
|
||||
#define UI_TEXT_WIFI_ONOFF "Wifi: %wo"
|
||||
#if NUM_EXTRUDER == 1
|
||||
#define UI_TEXT_LOAD_FILAMENT "Inser. Filament"
|
||||
#define UI_TEXT_UNLOAD_FILAMENT "Retir. Filament"
|
||||
|
|
|
@ -87,6 +87,9 @@ feed rate
|
|||
%fZ : Homing feedrate z direction
|
||||
%Fs : Fan speed
|
||||
%Fi : ignore M106 commands state
|
||||
%fl : loading feed rate
|
||||
%fu : unloading feed rate
|
||||
%fd : Unloading/loading distance
|
||||
|
||||
inactivity
|
||||
%is : Stepper inactive time in minutes
|
||||
|
@ -167,7 +170,8 @@ delta stuff
|
|||
Davinci Specific, extra information
|
||||
%so:Sound On/Off
|
||||
%la:LastAction
|
||||
%lo:Light On/Off
|
||||
%lo:Lights On/Off
|
||||
%lo:Badge Light On/Off
|
||||
%lk:KeepLight On/Off
|
||||
%sf:Filament Sensors:On/Off
|
||||
%zm : zMin
|
||||
|
@ -260,7 +264,11 @@ for 2 row displays. You can add additional pages or change the default pages lik
|
|||
#endif
|
||||
#endif
|
||||
//page 2
|
||||
UI_PAGE4(ui_page2,"X:%x0 mm","Y:%x1 mm","Z:%x2 mm","%os", ALL_MODE)
|
||||
#if MAX_HARDWARE_ENDSTOP_X || MAX_HARDWARE_ENDSTOP_Y || MAX_HARDWARE_ENDSTOP_Z
|
||||
UI_PAGE4(ui_page2,"X:%x0 mm %sx %sX","Y:%x1 mm %sy %sY","Z:%x2 mm %sz %sZ","%os", ALL_MODE)
|
||||
#else
|
||||
UI_PAGE4(ui_page2,"X:%x0 mm %sx","Y:%x1 mm %sy","Z:%x2 mm %sz","%os", ALL_MODE)
|
||||
#endif
|
||||
//page 3
|
||||
UI_PAGE4(ui_page3,UI_TEXT_SPEED_MULTIPLY,UI_TEXT_FLOW_MULTIPLY,UI_TEXT_PAGE_BUFFER,"%os", ALL_MODE)
|
||||
//printing time
|
||||
|
@ -314,7 +322,7 @@ next/previous changes the value
|
|||
ok sets the value if not already done and goes back to previous menu.
|
||||
*/
|
||||
//Davinci Specific, to follow the changes in future new commits and make it work for other than Davinci board likeRADDS/DUE
|
||||
#if !DAVINCI
|
||||
#if 1==0 //for native UI no need this FW, take original one
|
||||
// Error menu
|
||||
|
||||
UI_MENU_ACTION2(ui_menu_error,UI_ACTION_DUMMY,UI_TEXT_ERROR,"%oe")
|
||||
|
@ -1015,9 +1023,11 @@ UI_MENU_ACTIONCOMMAND(ui_menu_quick_preheat_abs,UI_TEXT_PREHEAT_ABS,UI_ACTION_PR
|
|||
UI_MENU_ACTIONCOMMAND(ui_menu_quick_cooldown,UI_TEXT_COOLDOWN_MENU,UI_ACTION_COOLDOWN, ADVANCED_MODE)
|
||||
//disable steppers
|
||||
UI_MENU_ACTIONCOMMAND_FILTER(ui_menu_quick_stopstepper,UI_TEXT_DISABLE_STEPPER,UI_ACTION_DISABLE_STEPPER,0,MENU_MODE_PRINTING, ALL_MODE)
|
||||
//bed down
|
||||
UI_MENU_ACTIONCOMMAND_FILTER(ui_menu_bed_down,UI_TEXT_BED_DOWN,UI_ACTION_BED_DOWN,0,MENU_MODE_PRINTING, ALL_MODE)
|
||||
|
||||
#define UI_MENU_MAINTENANCE {UI_MENU_ADDCONDBACK &ui_menu_load_unload_entry, UI_MENU_AUTOLEVEL &ui_menu_manual_level, UI_CLEAN_NOZZLE_ENTRY UI_CLEAN_DRIPBOX_ENTRY &ui_menu_quick_preheat_pla,&ui_menu_quick_preheat_abs,&ui_menu_quick_cooldown,&ui_menu_quick_stopstepper}
|
||||
UI_MENU(ui_menu_maintenance,UI_MENU_MAINTENANCE,6+UI_MENU_AUTOLEVEL_CNT+UI_CLEAN_NOZZLE_COUNT+UI_CLEAN_DRIPBOX_COUNT+UI_MENU_BACKCNT);//BUG without this ; compilation crash
|
||||
#define UI_MENU_MAINTENANCE {UI_MENU_ADDCONDBACK &ui_menu_load_unload_entry, UI_MENU_AUTOLEVEL &ui_menu_manual_level, UI_CLEAN_NOZZLE_ENTRY UI_CLEAN_DRIPBOX_ENTRY &ui_menu_bed_down,&ui_menu_quick_preheat_pla,&ui_menu_quick_preheat_abs,&ui_menu_quick_cooldown,&ui_menu_quick_stopstepper}
|
||||
UI_MENU(ui_menu_maintenance,UI_MENU_MAINTENANCE,7+UI_MENU_AUTOLEVEL_CNT+UI_CLEAN_NOZZLE_COUNT+UI_CLEAN_DRIPBOX_COUNT+UI_MENU_BACKCNT);//BUG without this ; compilation crash
|
||||
UI_MENU_SUBMENU(ui_menu_maintenance_entry, UI_TEXT_MAINTENANCE, ui_menu_maintenance, ALL_MODE)
|
||||
|
||||
// **** Positionning menu
|
||||
|
@ -1033,7 +1043,11 @@ UI_MENU_ACTIONCOMMAND(ui_menu_home_z,UI_TEXT_HOME_Z,UI_ACTION_HOME_Z, ADVANCED_M
|
|||
UI_MENU_CHANGEACTION(ui_menu_x_1," 1mm",UI_ACTION_X_1, ALL_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_x_10," 10mm",UI_ACTION_X_10, ALL_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_x_100,"100mm",UI_ACTION_X_100, ALL_MODE)
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_x_pos,"X: %x0mm ",UI_ACTION_DUMMY, ALL_MODE)
|
||||
#if MAX_HARDWARE_ENDSTOP_X
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_x_pos,"X:%x0mm %sx %sX",UI_ACTION_DUMMY, ALL_MODE)
|
||||
#else
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_x_pos,"X:%x0mm %sx",UI_ACTION_DUMMY, ALL_MODE)
|
||||
#endif
|
||||
#define UI_MENU_X_POS_VALUE {UI_MENU_ADDCONDBACK &ui_menu_x_1,&ui_menu_x_10,&ui_menu_x_100,&ui_menu_x_pos}
|
||||
UI_MENU_WITH_STATUS(ui_menu_pos_x_value,UI_MENU_X_POS_VALUE,4+UI_MENU_BACKCNT);//BUG without this ; compilation crash
|
||||
UI_MENU_SUBMENU(ui_menu_X_pos, UI_TEXT_X_POSITION, ui_menu_pos_x_value, ALL_MODE)
|
||||
|
@ -1041,7 +1055,12 @@ UI_MENU_SUBMENU(ui_menu_X_pos, UI_TEXT_X_POSITION, ui_menu_pos_x_value, ALL_MODE
|
|||
UI_MENU_CHANGEACTION(ui_menu_y_1," 1mm",UI_ACTION_Y_1, ALL_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_y_10," 10mm",UI_ACTION_Y_10, ALL_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_y_100,"100mm",UI_ACTION_Y_100, ALL_MODE)
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_y_pos,"Y: %x1mm ",UI_ACTION_DUMMY, ALL_MODE)
|
||||
#if MAX_HARDWARE_ENDSTOP_Y
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_y_pos,"Y:%x1mm %sy %sY",UI_ACTION_DUMMY, ALL_MODE)
|
||||
#else
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_y_pos,"Y:%x1mm %sy",UI_ACTION_DUMMY, ALL_MODE)
|
||||
|
||||
#endif
|
||||
#define UI_MENU_Y_POS_VALUE {UI_MENU_ADDCONDBACK &ui_menu_y_1,&ui_menu_y_10,&ui_menu_y_100,&ui_menu_y_pos}
|
||||
UI_MENU_WITH_STATUS(ui_menu_pos_y_value,UI_MENU_Y_POS_VALUE,4+UI_MENU_BACKCNT);//BUG without this ; compilation crash
|
||||
UI_MENU_SUBMENU(ui_menu_Y_pos, UI_TEXT_Y_POSITION, ui_menu_pos_y_value, ALL_MODE)
|
||||
|
@ -1050,7 +1069,12 @@ UI_MENU_CHANGEACTION(ui_menu_z_0_1,"0.1mm",UI_ACTION_Z_0_1, ALL_MODE)
|
|||
UI_MENU_CHANGEACTION(ui_menu_z_1," 1mm",UI_ACTION_Z_1, ALL_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_z_10," 10mm",UI_ACTION_Z_10, ALL_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_z_100,"100mm",UI_ACTION_Z_100, ALL_MODE)
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_z_pos,"Z: %x2mm ",UI_ACTION_DUMMY, ALL_MODE)
|
||||
#if MAX_HARDWARE_ENDSTOP_Z
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_z_pos,"Z:%x2mm %sz %sZ",UI_ACTION_DUMMY, ALL_MODE)
|
||||
#else
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_z_pos,"Z:%x2mm %sz",UI_ACTION_DUMMY, ALL_MODE)
|
||||
|
||||
#endif
|
||||
#define UI_MENU_Z_POS_VALUE {UI_MENU_ADDCONDBACK &ui_menu_z_0_1,&ui_menu_z_1,&ui_menu_z_10,&ui_menu_z_100,&ui_menu_z_pos}
|
||||
UI_MENU_WITH_STATUS(ui_menu_pos_z_value,UI_MENU_Z_POS_VALUE,5+UI_MENU_BACKCNT);//BUG without this ; compilation crash
|
||||
UI_MENU_SUBMENU(ui_menu_Z_pos, UI_TEXT_Z_POSITION, ui_menu_pos_z_value, ALL_MODE)
|
||||
|
@ -1159,6 +1183,15 @@ UI_MENU_ACTIONCOMMAND(ui_menu_toggle_light,UI_TEXT_LIGHTS_ONOFF,UI_ACTION_LIGHTS
|
|||
#define UI_TOOGLE_LIGHT_ENTRY
|
||||
#define UI_TOGGLE_LIGHT_COUNT 0
|
||||
#endif
|
||||
//Badge light on off
|
||||
#if BADGE_LIGHT_PIN > 0
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_toggle_badge_light,UI_TEXT_BADGE_LIGHT_ONOFF,UI_ACTION_BADGE_LIGHT_ONOFF, ALL_MODE)
|
||||
#define UI_TOOGLE_BADGE_LIGHT_ENTRY ,&ui_menu_toggle_badge_light
|
||||
#define UI_TOGGLE_BADGE_LIGHT_COUNT 1
|
||||
#else
|
||||
#define UI_TOOGLE_BADGE_LIGHT_ENTRY
|
||||
#define UI_TOGGLE_BADGE_LIGHT_COUNT 0
|
||||
#endif
|
||||
//sound on off
|
||||
#if FEATURE_BEEPER
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_sound,UI_TEXT_SOUND_ONOF,UI_ACTION_SOUND, ALL_MODE)
|
||||
|
@ -1189,6 +1222,16 @@ UI_MENU_ACTIONCOMMAND(ui_menu_top_sensoronoff,UI_TEXT_TOP_SENSOR_ONOFF,UI_ACTION
|
|||
#define UI_TOP_SENSOR_ONOFF_COUNT 0
|
||||
#endif
|
||||
|
||||
//wifi with external modul like ESP8266
|
||||
#if ENABLE_WIFI
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_wifi_onoff,UI_TEXT_WIFI_ONOFF,UI_ACTION_WIFI_ONOFF, ALL_MODE)
|
||||
#define UI_WIFI_ONOFF_ENTRY ,&ui_menu_wifi_onoff
|
||||
#define UI_WIFI_ONOFF_COUNT 1
|
||||
#else
|
||||
#define UI_WIFI_ONOFF_ENTRY
|
||||
#define UI_WIFI_ONOFF_COUNT 0
|
||||
#endif
|
||||
|
||||
//powersave easy entry
|
||||
#if UI_AUTOLIGHTOFF_AFTER > 0
|
||||
UI_MENU_ACTIONCOMMAND(ui_menu_powersave,UI_TEXT_POWER_SAVE,UI_ACTION_TOGGLE_POWERSAVE, EASY_MODE)
|
||||
|
@ -1248,9 +1291,12 @@ UI_MENU_CHANGEACTION(ui_menu_feedrate_maxy, UI_TEXT_FEED_MAX_Y, UI_ACTION_MAX_
|
|||
UI_MENU_CHANGEACTION(ui_menu_feedrate_maxz, UI_TEXT_FEED_MAX_Z, UI_ACTION_MAX_FEEDRATE_Z, ADVANCED_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_feedrate_homex, UI_TEXT_FEED_HOME_X, UI_ACTION_HOMING_FEEDRATE_X, ADVANCED_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_feedrate_homey, UI_TEXT_FEED_HOME_Y, UI_ACTION_HOMING_FEEDRATE_Y, ADVANCED_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_feedrate_loading_filament, UI_TEXT_FEED_LOADING_FILAMENT, UI_ACTION_LOADING_FEEDRATE, ADVANCED_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_feedrate_unloading_filament, UI_TEXT_FEED_UNLOADING_FILAMENT, UI_ACTION_UNLOADING_FEEDRATE, ADVANCED_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_feedrate_loading_unloading_distance, UI_TEXT_LOADING_UNLOADING_DISTANCE, UI_ACTION_LOAD_UNLOAD_DISTANCE, ADVANCED_MODE)
|
||||
UI_MENU_CHANGEACTION(ui_menu_feedrate_homez, UI_TEXT_FEED_HOME_Z, UI_ACTION_HOMING_FEEDRATE_Z, ADVANCED_MODE)
|
||||
#define UI_MENU_FEEDRATE {UI_MENU_ADDCONDBACK &ui_menu_feedrate_maxx,&ui_menu_feedrate_maxy,&ui_menu_feedrate_maxz,&ui_menu_feedrate_homex,&ui_menu_feedrate_homey,&ui_menu_feedrate_homez}
|
||||
UI_MENU(ui_menu_feedrate,UI_MENU_FEEDRATE,6 + UI_MENU_BACKCNT);//BUG without this ; compilation crash
|
||||
#define UI_MENU_FEEDRATE {UI_MENU_ADDCONDBACK &ui_menu_feedrate_maxx,&ui_menu_feedrate_maxy,&ui_menu_feedrate_maxz,&ui_menu_feedrate_homex,&ui_menu_feedrate_homey,&ui_menu_feedrate_homez,&ui_menu_feedrate_loading_filament, &ui_menu_feedrate_unloading_filament, &ui_menu_feedrate_loading_unloading_distance}
|
||||
UI_MENU(ui_menu_feedrate,UI_MENU_FEEDRATE,9 + UI_MENU_BACKCNT);//BUG without this ; compilation crash
|
||||
#else
|
||||
// **** Acceleration settings
|
||||
UI_MENU_CHANGEACTION(ui_menu_accel_printz,UI_TEXT_PRINT_Z_DELTA,UI_ACTION_PRINT_ACCEL_Z, ADVANCED_MODE)
|
||||
|
@ -1408,8 +1454,8 @@ UI_MENU(ui_menu_positions_size_seetings,UI_MENU_POSITIONS_SIZE_SETTINGS,6+UI_TOO
|
|||
|
||||
UI_MENU_SUBMENU(ui_menu_positions_size_settings_entry, UI_TEXT_POSITION,ui_menu_positions_size_seetings, ADVANCED_MODE)
|
||||
|
||||
#define UI_MENU_SETTINGS {UI_MENU_ADDCONDBACK &ui_menu_display_mode,&ui_menu_quick_speedmultiply, &ui_menu_quick_flowmultiply UI_TOOGLE_LIGHT_ENTRY UI_SOUND_ENTRY UI_SENSOR_ONOFF_ENTRY UI_TOP_SENSOR_ONOFF_ENTRY UI_POWER_SAVE_ENTRY ,&ui_menu_powersave_menu_entry MENU_PSON_ENTRY,&ui_menu_general_baud,&ui_menu_conf_accel,&ui_menu_conf_feed,&ui_menu_conf_extr UI_MENU_BEDCONF_COND ,&ui_menu_positions_size_settings_entry,&ui_menu_version UI_MENU_EEPROM_COND UI_MENU_DELTA_COND UI_MENU_SL_COND}
|
||||
UI_MENU(ui_menu_settings,UI_MENU_SETTINGS,10+UI_TOGGLE_LIGHT_COUNT+UI_SOUND_COUNT+UI_SENSOR_ONOFF_COUNT+UI_TOP_SENSOR_ONOFF_COUNT+UI_POWER_SAVE_COUNT+MENU_PSON_COUNT+UI_MENU_EEPROM_CNT+UI_MENU_BEDCONF_CNT+UI_MENU_DELTA_CNT+UI_MENU_SL_CNT+UI_MENU_BACKCNT);//BUG without this ; compilation crash
|
||||
#define UI_MENU_SETTINGS {UI_MENU_ADDCONDBACK &ui_menu_display_mode,&ui_menu_quick_speedmultiply, &ui_menu_quick_flowmultiply UI_TOOGLE_LIGHT_ENTRY UI_TOOGLE_BADGE_LIGHT_ENTRY UI_SOUND_ENTRY UI_SENSOR_ONOFF_ENTRY UI_TOP_SENSOR_ONOFF_ENTRY UI_WIFI_ONOFF_ENTRY UI_POWER_SAVE_ENTRY ,&ui_menu_powersave_menu_entry MENU_PSON_ENTRY,&ui_menu_general_baud,&ui_menu_conf_accel,&ui_menu_conf_feed,&ui_menu_conf_extr UI_MENU_BEDCONF_COND ,&ui_menu_positions_size_settings_entry,&ui_menu_version UI_MENU_EEPROM_COND UI_MENU_DELTA_COND UI_MENU_SL_COND}
|
||||
UI_MENU(ui_menu_settings,UI_MENU_SETTINGS,10+UI_TOGGLE_LIGHT_COUNT+UI_TOGGLE_BADGE_LIGHT_COUNT+UI_SOUND_COUNT+UI_SENSOR_ONOFF_COUNT+UI_TOP_SENSOR_ONOFF_COUNT+UI_WIFI_ONOFF_COUNT+UI_POWER_SAVE_COUNT+MENU_PSON_COUNT+UI_MENU_EEPROM_CNT+UI_MENU_BEDCONF_CNT+UI_MENU_DELTA_CNT+UI_MENU_SL_CNT+UI_MENU_BACKCNT);//BUG without this ; compilation crash
|
||||
UI_MENU_SUBMENU(ui_menu_settings_entry, UI_TEXT_SETTINGS, ui_menu_settings, ALL_MODE)
|
||||
|
||||
// **** Fan menu
|
||||
|
|
|
@ -76,7 +76,13 @@
|
|||
#endif
|
||||
#define ORIG_PS_ON_PIN -1
|
||||
#define PS_ON_PIN ORIG_PS_ON_PIN
|
||||
#if DAVINCI==4
|
||||
#define TOP_SENSOR_PIN 64
|
||||
#define BADGE_LIGHT_PIN 6
|
||||
#else
|
||||
#define TOP_SENSOR_PIN 6
|
||||
#define BADGE_LIGHT_PIN -1
|
||||
#endif
|
||||
#define SDSS 55
|
||||
#define MOSI_PIN 43
|
||||
#define MISO_PIN 73
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
@pause State A
|
||||
M42 P2 S0
|
||||
@pause State B
|
||||
M42 P2 S255
|
||||
@pause State A
|
||||
M42 P2 S0
|
||||
M42 P4 S0
|
||||
@pause State B
|
||||
M42 P4 S255
|
||||
@pause State A
|
||||
M42 P4 S0
|
||||
M42 P6 S0
|
||||
@pause State B
|
||||
M42 P6 S255
|
||||
@pause State A
|
||||
M42 P6 S0
|
||||
M42 P7 S0
|
||||
@pause State B
|
||||
M42 P7 S255
|
||||
M42 P7 S0
|
||||
@pause Reset Printer then change P values for new set of pins
|
||||
M112
|
|
@ -0,0 +1,83 @@
|
|||
@pause Set Sensor in state A like close the door
|
||||
M117 State A
|
||||
M42 P2
|
||||
M42 P4
|
||||
M42 P6
|
||||
M42 P7
|
||||
M42 P18
|
||||
M42 P19
|
||||
M42 P21
|
||||
M42 P22
|
||||
M42 P23
|
||||
M42 P24
|
||||
M42 P26
|
||||
M42 P27
|
||||
M42 P28
|
||||
M42 P18
|
||||
M42 P19
|
||||
M42 P21
|
||||
M42 P22
|
||||
M42 P31
|
||||
M42 P33
|
||||
M42 P46
|
||||
M42 P47
|
||||
M42 P48
|
||||
M42 P49
|
||||
M42 P50
|
||||
M42 P51
|
||||
M42 P54
|
||||
M42 P59
|
||||
M42 P60
|
||||
M42 P62
|
||||
M42 P64
|
||||
M42 P71
|
||||
M42 P85
|
||||
M42 P87
|
||||
M42 P100
|
||||
M42 P101
|
||||
M42 P104
|
||||
M42 P108
|
||||
M42 P116
|
||||
M42 P124
|
||||
@pause Change Sensor to state B like open the door
|
||||
M117 State B
|
||||
M42 P2
|
||||
M42 P4
|
||||
M42 P6
|
||||
M42 P7
|
||||
M42 P18
|
||||
M42 P19
|
||||
M42 P21
|
||||
M42 P22
|
||||
M42 P23
|
||||
M42 P24
|
||||
M42 P26
|
||||
M42 P27
|
||||
M42 P28
|
||||
M42 P18
|
||||
M42 P19
|
||||
M42 P21
|
||||
M42 P22
|
||||
M42 P31
|
||||
M42 P33
|
||||
M42 P46
|
||||
M42 P47
|
||||
M42 P48
|
||||
M42 P49
|
||||
M42 P50
|
||||
M42 P51
|
||||
M42 P54
|
||||
M42 P59
|
||||
M42 P60
|
||||
M42 P62
|
||||
M42 P64
|
||||
M42 P71
|
||||
M42 P85
|
||||
M42 P87
|
||||
M42 P100
|
||||
M42 P101
|
||||
M42 P104
|
||||
M42 P108
|
||||
M42 P116
|
||||
M42 P124
|
||||
@pause Chcheck which pin got state changed in serial
|
Ładowanie…
Reference in New Issue