-
-
Notifications
You must be signed in to change notification settings - Fork 2
Stored the current position on reboot #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the issue. Only when you call void begin(uint8_t pulsePin, uint8_t directionPin, uint8_t selectPin, uint8_t position = 0) Can you post a minimal sketch that shows the problem? |
Apologize. Conducted tests without a library. It looks like the problem is in the chip itself. Writing to NVRAM occurs always when CS=HIGH and does not depend on the state of INC. |
If I recall correctly the trigger to store is the rising low -> high of the CS line. Precondition is that the inc line is HIGH, there is a table in the datasheet, you should check it. That said it is a strange problem as if you restart the chip several times it would drop to zero. It might be useful to add some notes to the readme.md about this, so keep me informed of your insights. |
That's exactly what happens.
|
Good observation, |
@AndreiCo14 If you have time could you check / verify the working of the branch |
There is a problem with the build-CI. |
build-CI is running again. |
@AndreiCo14 In begin() I have the parameter position = 0. Q1: Should it not be better to use setPosition(position, true) as last line, to be sure the device and library are in sync? Q2: Or should the position parameter be removed from begin()? Alternative thought is to have a library that does not know anything about the position, and is just able to send INCR and DECR and STORE commands. That would be very minimalistic and still usable. Feedback about the position should be organized some other way. |
Maybe even better, the 3 lines should use pull-up resistors, so they are always HIGH at start. Could add this as advice in the readme.md |
I think that in order not to mislead by indicating the position in begin, which does not affect anything, it is better to remove this parameter. The user himself can set the position forcibly. |
My first experience showed that when restarting the controller, random position values were set. After that, I pulled CS to power. After that, I began to start adequately, but with the problem described above. ;) |
Updated the library
Like to hear your opinion if this is an improvement. IMHO making the position more explicit is a good step. Need time to build a setup to do real HW testing, to get a better feel of the merits of this conflict. |
The user can decide for himself whether to set explicit values or relative to the stored one. In addition, it is not always necessary to know the numeric value (for example, to save the sound level). |
Understand your point, however after a restart one does not know at which level the volume was stored and therefor at which volume level it will start. That makes it impossible to set the (internal) position correctly, or by all means to drop to 1/3rd of current volume as one does not know how many steps are needed. (note if the user does it interactively by listening and adjust there is a feedback loop outside the library) In the current code e.g. the incr() function takes the current position into account. This conflict leads to 2 different uses,
It is possible to add an ADC to provide the position feedback in another way but that is out of the scope of this library. The best solution I can think of at the moment is
This hierarchy would allow users to choose which functionality they need in their project. |
Extracted a X9C base class which is minimalistic, no position or Ohm information. This develop branch version will be merged coming days to keep the delta between versions not too large. |
@AndreiCo14 |
If a position other than 0 was previously stored, then when the controller is restarted, the stored value is reduced by 1 and the new position stored in the NVRAM.
The text was updated successfully, but these errors were encountered: