Giter Site home page Giter Site logo

found another "idle" status about megadesk HOT 15 CLOSED

gcormier avatar gcormier commented on August 23, 2024
found another "idle" status

from megadesk.

Comments (15)

gcormier avatar gcormier commented on August 23, 2024 1

dev branch merged into master which has this change - thanks for your work on this!

from megadesk.

gcormier avatar gcormier commented on August 23, 2024

Wow! Very interesting. I will add something to the firmware ASAP - do you have any captures we can add to the repo?

from megadesk.

satrik avatar satrik commented on August 23, 2024

@gcormier well, I'm using a Wemos D1 mini and playing around with a mix of trainman419/yours and my own code^^ I've changed the lin.h and use SoftwareSerial to get the HardwareSerial (USB) for debugging output and this is the only I can "capture".

If I do this

Serial.println("node_a[2]");
Serial.println(node_a[2]);
Serial.println("node_b[2]");
Serial.println(node_b[2]);

right before the second switch (state) it outputs:

16:52:56.346 -> node_a[2]
16:52:56.346 -> 37
16:52:56.346 -> node_b[2]
16:52:56.346 -> 37

And afterwards I have to use if (node_a[2] == 0x25 && node_b[2] == 0x25) to get it working.
That's the only thing that is different from the values in your code.

Please let me know if I can give you more information.

from megadesk.

gcormier avatar gcormier commented on August 23, 2024

Can I ask what the build date sticker on your controller is?

from megadesk.

satrik avatar satrik commented on August 23, 2024

image

from megadesk.

gcormier avatar gcormier commented on August 23, 2024

Interesting. I have 2020-32 Rec: C. If we assume that's a week code, yours is only a bit newer than mine and same revision.

I will probably add this to the codebase to be safe for those who are purchasing them. We can keep an eye on things.

I do wonder if the motors have changed. Perhaps the idle status is communicated during the startup. If you have any way to take a look at one of the motors to get the model #, that would be great to see if it's the same. If so it could still be a firmware update on the motors, although I don't see why they would update the firmware just to change the idle code.

from megadesk.

satrik avatar satrik commented on August 23, 2024

This is the only visible from the outside.
image

from megadesk.

tagno25 avatar tagno25 commented on August 23, 2024

Would it be possible that when toggleIdleParameter() is executed to set LIN_MOTOR_IDLE to node_a[2], as long as node_a[2] and node_b[2] are the same?

I know the variable is currently out of scope, it would require moving the declaration and then setting node_a and node_b to zero every loop.
Would that work to find the idle status, and any future idle status values?

You wouldn't even have to check what the current LIN_MOTOR_IDLE value is and it saves 36 bytes of flash space when I tested it.

void toggleIdleParameter()
{
  if (node_a[2] == node_b[2])
  {
    LIN_MOTOR_IDLE = node_a[2];
    for (uint8_t i = 0; i < 3; i++)
    {
      beep(1, 2637);
      delay(10);
      beep(1, 2349);
      delay(10);
      beep(1, 2093);
      delay(10);
    }
  }

  EEPROM.write(2, LIN_MOTOR_IDLE);
}

from megadesk.

satrik avatar satrik commented on August 23, 2024

While my testing I've seen that node_a[2] seems to be always the same as node_b[2]. For example, while pressing Up/Down it reports both as 34.

08:26:13.259 -> DOWN BTN
08:26:13.259 -> node_a[2]
08:26:13.259 -> 34
08:26:13.259 -> node_b[2]
08:26:13.259 -> 34

Not sure if it is the best way to just compare these 2 values.

To avoid toggling between the "hard" IDLE states, I've just written my code like this currently. Until now I don't have issues with this.

if (user_cmd != Command::NONE) {
    if (node_a[2] == node_b[2]) {
        if (node_a[2] == 0x25 || node_a[2] == 0x00 || node_a[2] == 0x60){
            state = State::STARTING;
        }
    }
}

from megadesk.

gcormier avatar gcormier commented on August 23, 2024

I'd be up for trying - I do have 2 desks that use different variant modes, so I can test how it works between the two :) Would you be up for submitting a pull request?

from megadesk.

satrik avatar satrik commented on August 23, 2024

@gcormier I've created #48

Please check if I did remove the right things from the initAndReadEEPROM() function^^

from megadesk.

gcormier avatar gcormier commented on August 23, 2024

I've got it flashed and seems to work well on the 1st desk. I'm gonna soak test it for a little bit.

I'm also wondering how risky it would be to have it accept more new idle values. If we have a list of known non-idle states.

from megadesk.

satrik avatar satrik commented on August 23, 2024

Im currently testing an extra function after lin init to get the IDLE value and store it in a variable. Seems to work so far, but still needs some testing.

Another thing I think about is to completly remove the IDLE state "check". I'm not 100% sure why it is needed in the second switch to find the next state 🤔 But I'm also not sure if it is a good idea to test it on my table 😄

from megadesk.

gcormier avatar gcormier commented on August 23, 2024

I mean, test away :)

The idea is that we'd rather not issue a move command (potentially in the opposite direction) before the motors have finished "their thing". So when letting go of up, you have that small decelleration period during which pushing the opposite direction does nothing.

That said, in actual use if you aren't trying to actually break something, it could be fine. You'd almost need to time the mashing of the buttons perfectly as the accel/decel is a very narrow window of time.

I do plan to run some flashing cables externally of the case so I can update firmware more easily to play around (I do use this desk daily for my job :) )

from megadesk.

gcormier avatar gcormier commented on August 23, 2024

newly made dev branch now has these changes incorporated. I kind of butchered things, but it's there now.

from megadesk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.