Hello everyone ,
ive been trying to get this fillament resetter to work with code i found
https://github.com/NeoRame/DaVinci-Cartridge-Programmer/blob/master/README.md
But i think my screen is a different one .
i found a youtube video showing to change
tft.reset();
tft.begin(0x9341); // SDFP5408
//tft.invertDisplay(true);
Serial.begin(115200);
pinMode(13, OUTPUT);
read_eeprom(0,128);
updatevars ();
splash ();
drawButtons ();
drawMenu ();
to
0x9325
this worked and the screen came alive but i think i need to change the library to mcufriends_kbv
but i cannot find how since my coding skill is limited to copy paste
So now the display works but not the touch , i tried touch shield
09:55:58.703 -> Most Touch Screens use pins 6, 7, A1, A2
09:55:58.737 -> But they can be in ANY order
09:55:58.771 -> e.g. right to left or bottom to top
09:55:58.805 -> or wrong direction
09:55:58.839 -> Edit name and calibration statements
09:55:58.872 ->
09:55:58.872 -> Please Calibrate.
09:55:58.872 -> ID=0x5408
09:55:58.906 -> Screen is 240x320
09:55:58.906 -> Calibration is:
09:55:58.940 -> LEFT = 907 RT = 136
09:55:58.974 -> TOP = 942 BOT = 139
09:55:58.974 -> Wiring is always PORTRAIT
09:55:59.008 -> YP=15 XM=16
09:55:59.008 -> YM=7 XP=6
i hope someone with more knowledge of coding can help me with my project .
// DaVinci Cartridge Programmer v2.0 by NeoRame (Originally known as DaVinci Filament Configurationv1.0 by CdRsKuLL)
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library
#include <TouchScreen.h>
#include <Logo.h> // XYZPrinting Logo
#ifndef _NANODEUNIO_LIB_H
#define _NANODEUNIO_LIB_H
#if ARDUINO >= 100
#include <Arduino.h> // Arduino 1.0
#else
#include <WProgram.h> // Arduino 0022
#endif
#define NANODE_MAC_DEVICE 0xa0
#define NANODE_MAC_ADDRESS 0xfa
class NanodeUNIO {
private:
byte addr;
public:
NanodeUNIO(byte address);
boolean read(byte *buffer,word address,word length);
boolean start_write(const byte *buffer,word address,word length);
boolean enable_write(void);
boolean disable_write(void);
boolean read_status(byte *status);
boolean write_status(byte status);
boolean await_write_complete(void);
boolean simple_write(const byte *buffer,word address,word length);
};
#endif /* _NANODEUNIO_LIB_H */
// the following are addresses for the various parameters
// to be programmed
#define MATERIAL 0x01 // 1 Byte
#define COLOR 0x02 // 2 Bytes
#define TOTALLEN 0x08 // 4 Bytes
#define NEWLEN 0x0C // 4 Bytes
#define HEADTEMP 0x10 // 2 Bytes
#define BEDTEMP 0x12 // 2 Bytes
#define MLOC 0x14 // 2 Bytes
#define DLOC 0x16 // 2 Bytes
#define SN 0x18 //12 Bytes
#define CRC 0x24 // 2 Bytes
#define LEN2 0x34 // 4 Bytes
// ==========================================================
int bed = 90; //default value
int extruder = 210; //default value
int materialtype = 1; //Material type 0 - PLA , 1 - ABS , 2 - Flex
int roll = 1; //Roll length 0 - 120 , 1 - 240 , 2 - 400
int intColor = 1; //Color 1 = Black as default
char mt[1];
char bt[] = {bed,0x00};
char et[] = {extruder,0x00};
char m[] = {0x41};
char selcolor[15] = "Black"; //Max Letters 15
char cr[] = {0x4B,0x00};
#define UNIO_STARTHEADER 0x55
#define UNIO_READ 0x03
#define UNIO_CRRD 0x06
#define UNIO_WRITE 0x6c
#define UNIO_WREN 0x96
#define UNIO_WRDI 0x91
#define UNIO_RDSR 0x05
#define UNIO_WRSR 0x6e
#define UNIO_ERAL 0x6d
#define UNIO_SETAL 0x67
#define UNIO_TSTBY 600
#define UNIO_TSS 10
#define UNIO_THDR 5
#define UNIO_QUARTER_BIT 10
#define UNIO_FUDGE_FACTOR 5
#define UNIO_OUTPUT() do { DDRD |= 0x10; } while (0)
#define UNIO_INPUT() do { DDRD &= 0xef; } while (0)
static void set_bus(boolean state) {
PORTD=(PORTD&0xef)|(!!state)<<4;
}
static boolean read_bus(void) {
return !!(PIND&0x10);
}
static void unio_inter_command_gap(void) {
set_bus(1);
delayMicroseconds(UNIO_TSS+UNIO_FUDGE_FACTOR);
}
static void unio_standby_pulse(void) {
set_bus(0);
UNIO_OUTPUT();
delayMicroseconds(UNIO_TSS+UNIO_FUDGE_FACTOR);
set_bus(1);
delayMicroseconds(UNIO_TSTBY+UNIO_FUDGE_FACTOR);
}
static volatile boolean rwbit(boolean w) {
boolean a,b;
set_bus(!w);
delayMicroseconds(UNIO_QUARTER_BIT);
a=read_bus();
delayMicroseconds(UNIO_QUARTER_BIT);
set_bus(w);
delayMicroseconds(UNIO_QUARTER_BIT);
b=read_bus();
delayMicroseconds(UNIO_QUARTER_BIT);
return b&&!a;
}
static boolean read_bit(void) {
boolean b;
UNIO_INPUT();
b=rwbit(1);
UNIO_OUTPUT();
return b;
}
static boolean send_byte(byte b, boolean mak) {
for (int i=0; i<8; i++) {
rwbit(b&0x80);
b<<=1;
}
rwbit(mak);
return read_bit();
}
static boolean read_byte(byte *b, boolean mak) {
byte data=0;
UNIO_INPUT();
for (int i=0; i<8; i++) {
data = (data << 1) | rwbit(1);
}
UNIO_OUTPUT();
*b=data;
rwbit(mak);
return read_bit();
}