-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp_config.cpp
67 lines (62 loc) · 1.36 KB
/
app_config.cpp
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
/*
* author : Shuichi TAKANO
* since : Sat Apr 13 2024 19:27:25
*/
#include "app_config.h"
#include "serializer.h"
void AppConfig::serialize(Serializer &s)
{
s.append8u(VERSION);
s.append8u(initPowerOn);
s.append8u(dispFPS);
s.append8u(buttonDispMode);
s.append8u(backLight);
s.append8u(rapidModeSynchro);
s.append8u(softwareRapidSpeed);
for (int i = 0; i < 6; ++i)
{
s.append8u(rapidPhase[i]);
}
for (auto &rs : rapidSettings)
{
s.append32u(rs.mask);
s.append8u(rs.div);
}
for (auto &re : rotEnc)
{
s.append8u(re.reverse);
s.append16u(re.scale);
s.append8u(re.axis);
}
s.append8u(nAnalogAxis);
}
bool AppConfig::deserialize(Deserializer &s)
{
if (s.peek8u() != VERSION)
{
return false;
}
initPowerOn = s.peek8u();
dispFPS = s.peek8u();
buttonDispMode = s.peek8u();
backLight = s.peek8u();
rapidModeSynchro = s.peek8u();
softwareRapidSpeed = s.peek8u();
for (int i = 0; i < 6; ++i)
{
rapidPhase[i] = s.peek8u();
}
for (auto &rs : rapidSettings)
{
rs.mask = s.peek32u();
rs.div = s.peek8u();
}
for (auto &re : rotEnc)
{
re.reverse = s.peek8u();
re.scale = s.peek16u();
re.axis = s.peek8u();
}
nAnalogAxis = s.peek8u();
return true;
}