Hey guys. Havent been back here for a while (havent coded in years too so i look like chump to people here by now lol

), Good to see there is an RPI section now

.
While not related directly to an RPI, i have been getting very frustraded with a thing i am working on for a RPI-based project. A trashy little netbook thing.

As i started building it i ran across this other dudes project similar to mine but less trashy so i followed that.
https://www.hackster.io/BuildItDR/raspberry-pi-and-arduino-laptop-bf50f5
One of the things i have a problem with is something the dude (not sure if the same guy) the guy made a seperate guide for it. A touchpad.
I gutted several old notebooks and to my surprise most of them are pretty common Synaptics or Alps touchpads (didnt find any documectation on the ALPS but i had better luck finding the pinouts to a synaptic pad).
In the process i learned that most older laptops keyboards and touchpads run on PS/2 and Raspberry pi dosent have PS/2
Thats where THIS guide comes in
https://www.hackster.io/BuildItDR/arduino-controlled-usb-trackpad-f443a6
Bought an Arduino to use as a usb microcontroller. The process is pretty much using the arduino to convert the PS/2 data into USB data and its pretty much the only thing i dont understand in depth right now because i played around with this code for weeks but i cannot beat it, The worst part is, the code works, just not the way its supposed to.
#include <Mouse.h>
#include <ps2.h>
#define PS2_DATA 10
#define PS2_CLK 9
byte mstat1;
byte mstat2;
byte mxy;
byte mx;
byte my;
byte mz;
int msval[2];
int repeatCnt;
PS2 moose(PS2_CLK, PS2_DATA);
void setup() {
Mouse.begin();
moose.write(0xff);
moose.read();
moose.read();
moose.read();
moose.write(0xf0);
moose.read();
delayMicroseconds(100);
moose.write(0xe8);
moose.read();
moose.write(0x03);
moose.read();
moose.write(0xe8);
moose.read();
moose.write(0x00);
moose.read();
moose.write(0xe8);
moose.read();
moose.write(0x01);
moose.read();
moose.write(0xe8);
moose.read();
moose.write(0x00);
moose.read();
moose.write(0xf3);
moose.read();
moose.write(0x14);
moose.read();
Serial.begin(9600);
}
void ms_read()
{moose.write(0xeb);
moose.read();
mstat1 = moose.read();
mxy = moose.read();
mz = moose.read();
mstat2 = moose.read();
mx = moose.read();
my = moose.read();
msval[0] = (((mstat2 & 0x10) << 8) | ((mxy & 0x0F) << 8) | mx );
msval[1] = (((mstat2 & 0x20) << 7) | ((mxy & 0xF0) << 4) | my );
msval[2] = int(mz);
}
void loop() {
ms_read();
if (msval[0] > 0 and msval[2] > 10)
{ repeatCnt++; }
else
{ repeatCnt = 0; }
if (repeatCnt > 2)
{
msval[0] = map(msval[0], 580, 5164, -1023, 1023);
msval[1] = map(msval[1], 1120, 5967, 1023, -1023);
Mouse.move(msval[0]/200,msval[1]/200);
}
}
Its hard to explain without seeing it but the way this code is making the touchpad behave is not like how a regular touchpad acts. This one looks like its trying to be a touchscreen maybe idk, Basically the cursor seems to be "chasing" the position of where your finger has been. Like if i take a finger and slide it from left to right of the mousepad, a regular laptop would move the cursor from left to right no matter where its position was before that.
How this looks like with the code i pasted above:
I slide my finger from left to right... (For the sake of visualization lets just say the cursor is located in the middle of the screen) As i put my finger on the left side if the touchpad, The cursor moves to where i put my finger before continuing to chase after the fingers movements. This mechanism is pretty awkward as you can imagine, if i slide the cursor to the right, it first moves to the left (the position where my finger touched first). Touchpad cursors are supposed to be copying your fingers movements not chasing after your fingers position like a game of snake. Like i put my finger and hold anywhere on this DIY touchpad's surface, the cursor is moving towards my finger. Its not supposed to be doing it. The cursor should only move when my fingers move.
Yes the code is simple and i understand most of it aside from :
//the part where it convewrts PS2 data to USB data is the only thing i cant wrap my head around.
msval[0] = (((mstat2 & 0x10) << 8) | ((mxy & 0x0F) << 8) | mx );
msval[1] = (((mstat2 & 0x20) << 7) | ((mxy & 0xF0) << 4) | my );
but as i mentioned earlier i havent coded in years and i am probably missing something... Maybe its i dont know how touchpads work in depth or maybe the guy who wrote it didnt bother commenting it. (i had to read commented library code just to figure out whats in here, But no big deal, Good practice to get back into it i guess.
So yeah, if anyone has any insight on how to program a touchpad correctly and what i am doing wrorng or point me in the righjt direction

.
I usually dont like asking for help but this got pretty frustrating for me especially when the thing is almost finished no to mention that during this jorney of discovery i started slowly realizing how absolutley AWFUL Rasbberry Pi is. In my opinion Raspberry pi is an overhyped nerd toy worse than literally any single-board computer on the market. I recentley bought a used Orange-Pi for $20 thinking its a more expensive clone of the raspberry pi and but NO! Orange pi is actually a pretty serious piece of hardware with so much more possiblities. (did i mention its backwards compatible with pretty much everything that Rasp has?) But honestly guys, i realize this is a raspberry pi section of the forum and you guys love them (I did too once) There is a whole WORLD significantly better single-board computers. Cubieboard, banana pi, Firefly, odroid, VIA old industrial propriotery motherboards running windows CE or even an old smartphone motherboard, is better ARM project computer than a raspberry pi. Even those tiny cube "friendly ARM" allwinner are better and more flexable in my opinion. (i am surprised myself, i thought they were crap)..... The controller from my old network harddrive case is actually a pretty neat one too. 200mhz, 16 mb of ram but no monitor You can only acess it via SSH but even that is a pretty interesting piece. People managed to install Debian 5 on it lol)
And to finish off venting anger, I would just like to express how much i hate touchscreens (This is why i am so bent on getting this touchpad to work instead of just buying a touchscreen). I have nothing against touchscreens actually but the idea that touchscreens are being jammed into every piece of equipment. Yes sometimes it makes more sence, and sometimes its cheaper and more practical to get a touchscreen but who likes screens covered in fingerprints? Also i cant feel they keyboard buttons with my thumbs that cover the surface area of like 5 buttons and often lead to annoying spelling mistakes? The screen is for the eyes not for the fingers.
Anyway, it would be great if someone here knows something about my touchpad problem. I really want to finish building this piece of crap to use for.... a portable bootserver... lol because thats all a RPI laptop seems to be good for
UPDATE:. I take back my words about touchscreens, I still dont like them but as it turns out that there is a good reason the industry moved away from buttons. Its because physical keys cant unstick immediatley and this caused a lot of pain for developers (Now i know the reason, for the delay command), Infact i remember learning this in school 11 years ago when i first joined this forum!
(I wonder what other things have i wrongly blamed on corporate greed)
OK so after a day of reading material i decided its possible for me to write a touchpad driver eventually by simply doing these really comprehensable programming tutorials arduino community is offerring. So i guess ill do that and share my results here.
Your signature has been erased by a mod