1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
use addr::ReadableEEPAddr;
use addr::ReadableRamAddr;
use addr::WritableEEPAddr;
use addr::WritableRamAddr;
use arrayvec::ArrayVec;
pub enum RegisterRequest {
EEPWrite(WritableEEPAddr),
EEPRead(ReadableEEPAddr),
RamWrite(WritableRamAddr),
RamRead(ReadableRamAddr),
}
pub(crate) struct SJogRequest {
pub(crate) data: ArrayVec<[SJogData; 10]>,
pub(crate) playtime: u8,
}
pub(crate) type IJogRequest = ArrayVec<[IJogData; 10]>;
#[derive(Debug)]
pub enum SpecialRequest {
Stat,
Rollback { skip_id: u8, skip_baud: u8 },
Reboot,
}
#[derive(Clone, Copy)]
pub enum Rollback {
SkipId,
SkipBaud,
SkipBoth,
SkipNone,
}
#[derive(Debug)]
pub enum JogMode {
Normal {
position: u16,
},
Continuous {
speed: u16,
},
}
impl JogMode {
pub(crate) fn associated_data(&self) -> u16 {
match *self {
JogMode::Normal { position } => position,
JogMode::Continuous { speed } => speed,
}
}
}
impl Default for JogMode {
fn default() -> Self {
JogMode::Normal { position: 0 }
}
}
#[derive(Debug)]
pub enum JogColor {
Red,
Green,
Blue,
}
impl Default for JogColor {
fn default() -> Self {
JogColor::Green
}
}
#[derive(Default, Debug)]
pub(crate) struct SJogData {
pub mode: JogMode,
pub color: JogColor,
pub id: u8,
}
impl SJogData {
pub(crate) fn new(mode: JogMode, color: JogColor, id: u8) -> Self {
SJogData { mode, color, id }
}
}
#[derive(Default, Debug)]
pub(crate) struct IJogData {
pub mode: JogMode,
pub color: JogColor,
pub playtime: u8,
pub id: u8,
}
impl IJogData {
pub(crate) fn new(mode: JogMode, color: JogColor, playtime: u8, id: u8) -> Self {
IJogData {
mode,
color,
id,
playtime,
}
}
}