-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstateobj_subsystems.cpp
More file actions
51 lines (43 loc) · 1.3 KB
/
stateobj_subsystems.cpp
File metadata and controls
51 lines (43 loc) · 1.3 KB
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
#include <defs.h>
#include "stateobj.h"
#include "system_datarequest.h"
#ifdef TTGO
#include "system_gps.h"
#endif
#include "system_reactionwheel.h"
#include "system_irarray.h"
#include "system_light.h"
void CStateObj::addSystem(CMsg &msg){
writeconsole("Adding System: ");
std::string sys = msg.getSYS();
std::string act = msg.getACT();
std::string CMDID = msg.getCMDID();
std::string ID = msg.getID();
CSystemObject* psys=nullptr;
psys=FindName(sys);
if(psys!=nullptr){
writeconsole("Error: Object ALREADY EXISTS Turning existong one ON()");
psys->on();
return;
}
writeconsoleln(sys);
writeconsoleln("");
if(subsystems.size()>100) {
writeconsole("Error: Too Many Objects Not creating new one.");
return; //Prevents from too many things running and blowing up system memory
}
/*
#ifdef TTGO
if (sys == "GPS") psys = new CGPS(msg);
#endif
if (sys == "IMU") psys = new CIMU(msg);
if (sys == "MT") psys = &MT;
if (sys == "MAGX") psys = &MAGX;
if (sys == "MAGY") psys = &MAGY;
if (sys == "MAGZ") psys = &MAGZ;
if (sys == "LIGHT") psys = new CLight(msg);
if (sys == "DATAREQUEST") psys = new CDataRequest(msg);
*/
psys=getSystem(sys.c_str());
if (psys!=NULL) subsystems.push_back(psys);
}