Open thomasloven opened 5 years ago
I did a bit of experimenting with operation states last summer. Here's a summary of my changes to the code:
void loop() {
...
if(previousState != -1)
{
state = previousState;
previousState = -1;
}
switch(command)
{
case CMD_AUTO:
break;
case CMD_HOME:
if(state != DOCKING && state != CHARGING && state != LOOKING_FOR_BWF)
state = LOOKING_FOR_BWF;
if(state == LAUNCHING) // This obviously never happens... don't know what I was thinking
state = CHARGING;
case: CMD_LAUNCH:
if(state == CHARGING)
state = LAUNCHING
command = CMD_AUTO;
break;
case CMD_PAUSE:
if(previousState == -1)
previousState = state;
state = PAUSED;
break;
}
switch(state) {
case MOWING:
...
}
Some notes after discussions among devs on 2019-05-12.
Here's some things I think we agreed on
The interface(s) should be able to:
B:11998;M:2;E:0
is ok, binary data is not)We also discussed storing configuration settings in the eeprom of the arduino.
Some of my own thoughts:
Roadmap
Define the serial interface and set up a method
The display library is definitely the best place to put this. I propose we rename it "Interface" and let it take responsibility for communication both ways. Be it through a serial connection of through an LCD and physical buttons on the machine.
We should also retract the recommendation to not override the
MYSIDPLAY::update()
function. I believe the thought was that the interface should be consistent, but it's very limiting.A new parameter for the operation mode will have to be added to the constructor as well.
Add operation modes
E.g.
AUTO
/GO
/HOME
/PAUSE
/(DEBUG
) This can be done in parallell with the serial interface.Some thought will need to go into the details of the behavior. If the mower is docked, and sent the
GO
command, should it go immediately, or should it wait until the battery is fully charged?Reference implementation of control interface
I don't have much ideas here... This could be something really really simple, like plugging in an esp01 with esp-link and a command line interface to control it from a PC, or it could be a esp32 running a full web interface...
Configuration storage
As was mentioned, storing configuration options in eeprom would allow distributing precompiled hex files, ready to upload to the mower.
A possible problem with storing configuration in EEPROM is that it requires a communication interface to set them. Unless we can come up with a way to override default settings only if defined in EEPROM... or something...