Skip to content

Change state and drive mode messages from string to custom message types #14

Description

@mattjay1024

I'm not sure how or even if Yeti dealt with this, but every node I've written with RSC in mind needs a parameter for the state and drive mode string (unless I want to use magic strings (which I don't)).

What we can do instead is make a custom message, with the states declared as constants there. So instead of

if (state_msg.data == "ready") {
    // do stuff
}

it becomes something like

if (state_msg.state == state_msg.STATE_READY) {
    // do stuff
}

The message types might look something like this

# State
int32 STATE_KILL = -1
int32 STATE_PAUSE = 0
int32 STATE_READY = 1
int32 STATE_STARTUP = 2
int32 STATE_SOFT_PAUSE = 3
int32 state

# Drive Mode
int32 MODE_MANUAL = 0
int32 MODE_AUTO = 1
int32 mode

I honestly don't remember if we talked about this and discarded it before, but it's been bothering me while going through Ohm's code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions