MCPcopy Create free account
hub / github.com/Santroller/Santroller / load_cycle

Function load_cycle

src/config.cpp:463–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461 return true;
462}
463bool load_cycle(pb_istream_t *stream, const pb_field_t *field, void **arg)
464{
465 auto profile = working_profile;
466 printf("found cycle! %p\r\n", profile.get());
467 auto last_cycle = new CycleInput();
468 last_special = last_cycle;
469 proto_CycleInput input;
470 input.input.cb_input.funcs.decode = load_input_dev;
471 input.input.cb_input.arg = arg;
472 if (!pb_decode(stream, proto_CycleInput_fields, &input))
473 {
474 printf("couldnt decode cycle input?\r\n");
475 return false;
476 }
477
478 printf("check %d %d\r\n", input.deviceid, profile->devices.size());
479 if (profile->devices.find(input.deviceid) == profile->devices.end())
480 {
481 printf("why tho\r\n");
482 return true;
483 }
484 printf("loading cycle\r\n");
485 last_cycle->load(input, std::static_pointer_cast<CycleDevice>(profile->devices[input.deviceid]), input.has_input ? make_input(input.input, profile, stream) : nullptr, input.has_inputReverse ? make_input(input.inputReverse, profile, stream) : nullptr);
486 printf("loaded cycle\r\n");
487 return true;
488}
489bool load_toggle(pb_istream_t *stream, const pb_field_t *field, void **arg)
490{
491 auto profile = working_profile;

Callers

nothing calls this directly

Calls 4

pb_decodeFunction · 0.85
make_inputFunction · 0.85
endMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected