Skip to content

Commit 13da06c

Browse files
committed
add oneshot
1 parent b23aed8 commit 13da06c

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

cangen/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ Occassionally you may want Calypso to also send a message on the CAN network. Us
6565
- `key`, string representing the key to index the Encodable Message to, e.g. it would be sent to Calypso on `"Calypso/Bidir/Command/{key}"`
6666
- `is_ext`, boolean representing whether the CAN ID is extended or standard (`false` by default)
6767
It is recommended that the decoding of the message be done to the topic `"Calypso/Bidir/State/{key}/{field_name}"`. Note decoding works exactly the same with these messages, so serves as an accurate representation of what Calypso is current sending out to the car.
68-
69-
Also, you should allow for simulation of the data point whenever possible.
70-
- `sim_freq`, integer frequency of which this message is usually emitted, in ms
68+
- `bidir_mode`, string specifying which bidirectionality functional profile the message uses (`broadcast` by default). Options:
69+
- `broadcast`: The message is sent on a loop of about one second with the most recent value, or the default value (see below). Default value is required.
70+
- `oneshot`: The message is sent once instantaneously upon reception of a setting. There are no default values used.
7171

7272
You may want to publish the fields of a message to additional MQTT clients. Add the following optional field to specify which additional client ports the fields should be published on.
7373
- `clients`, (optional) list of u16s representing the ports of additional MQTT clients to publish to. Currently supported additional ports are: 1882
@@ -90,7 +90,7 @@ Within the `points` member of a NetField object, there is a list of Point object
9090
- `endianness` (optional), string representing the byte endianness of the bits being read, either `"big"` or `"little"` (`"big"` by default)
9191
- `format` (optional), string representing the format of the bits (e.g. `divide100`) (blank by default)
9292
- Use an existing formatter if possible. To create a new one, add it to the `impl FormatData` block in `Calypso/src/data.rs`. Name it what it does if it could be reused by unrelated functions (ex. divide by 100 --> `divide100`) or if its very obscure use whats its used for (ex. multiply by 0029 in IMU datasheet --> `acceleration`). Include `_d` and `_e` implementations for decoding and encoding, respectively
93-
- `default_value` (optional, only for Encodable Messages), float representing the default value to be sent before a command is received or when an empty command is received. This is ignored when decoding the Point (`0` by default)
93+
- `default_value` (optional, only for Encodable Messages), float representing the default value to be sent before a command is received or when an empty command is received. This is ignored when decoding the Point, and ignored if using bidirectionality profile `oneshot` (`0` by default)
9494
- `ieee754_f32` (optional), boolean indicating if the bits in the Point should be interpreted as an IEEE754 32-bit float. **Be sure to endian swap the float before sending!!** (`false` by default)
9595
- `sim` (optional), the simulation mode for the Point. See below
9696

@@ -102,9 +102,9 @@ Within the `sim` member of a CANPoint object, there is a single sim object. Thi
102102
- `max`, float, the maximum value to emit
103103
- `inc_min`, float, the minimum increment
104104
- `inc_max`, float, the maximum increment
105-
- `round`, bool, whether to round values to a whole number (more precise rounding is not supported)
105+
- `round`, bool, whether to round values to a whole number (more precise rounding is not supported) (default: false)
106106

107-
or
107+
**or**
108108
`enum`: choose from a certain list of values
109109
- `options`, list[[`value`, `freq`]...], a list containing lists of length two. Each inner list's first item is the value to be emitted, and the second item is the probability the item should be emitted. **These probabilities must add to 1, or they won't be obeyed.**
110110

cangen/can-messages/calypso_cmd.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
{
9292
"id": "0xFFFFF",
9393
"desc": "Example Enc Msg Ext",
94+
"bidir_mode": "oneshot",
9495
"points": [
9596
{
9697
"size": 32,

0 commit comments

Comments
 (0)