czietz/wifimicroscope

Make zoom work

Closed this issue · 3 comments

The buttons on my microscope have no effect on the image input.
Although they work when i use my smartphone.

Currently I'm clueless why this is happenning, or does the smartphone-app itself digitally zoom in?(i hope that is not how it is doing it)

From my website:

What about the "status service" port? Pressing a key (take a snapshot, zoom in, zoom out) on the microscope sends a "JHCMD" packet from the microscope to this port on the computer.

I'm pretty sure this is purely a digital zoom in the app. From the decompiled source code:

    @Subscriber(tag = "OnGetGP_Status")
    private void getkey(int nStatus) {
        byte key = (byte) nStatus;
        if (key == 1) {
            paiORlu(0);
        } else if (key == 5) {
            this.scal -= 0.2f;
            if (this.scal < 1.0f) {
                this.scal = 1.0f;
            }
            if (this.scal > 2.0f) {
                this.scal = 2.0f;
            }
            wifination.naSetScal(this.scal);
            showScale("X" + (((float) Math.round(this.scal * 100.0f)) / 100.0f));
        } else if (key == 4) {
            this.scal += 0.2f;
            if (this.scal < 1.0f) {
                this.scal = 1.0f;
            }
            if (this.scal > 2.0f) {
                this.scal = 2.0f;
            }
            wifination.naSetScal(this.scal);
            showScale("X" + (((float) Math.round(this.scal * 100.0f)) / 100.0f));
        }
    }

Thus, the reaction to key presses is to call back to naSetScale(): https://github.com/aivenlau/JH-Libary_N_FFMPEG/blob/f61ec630330918ba2ea16aaed8e0c88f54901d8f/JH-Libary/JH_WifiCamera.m#L9292, which merely sets the variable _nScale which is then used while processing the image. No command is transmitted back to the microscope.

Thanks.
Now it feels like getting scammed.
Atleast if digital zoom gets advertised as real zoom.
(*cough* they advertised a 50x to 1000x zoom ... guess I didn't activate my braincells before buying).
But I guess you can't expect anything like that for the price I paid.

Also means that they put additional resources (like buttons) just to make you believe that you can actually control zoom.
But kinda explains the bad quality if you zoom in.
I mean why the add those buttons if you could control "zoom level" inside the app directly?
(because it would be too obvious inside the app?)

In my microscope the real/optical zoom is adjusted mechanically. (The mechanism feels rather cheap - but YGWYPF.) I have no idea why they included the digital zoom buttons on top.