MCPcopy Create free account
hub / github.com/JibbSmart/JoyShockMapper / GyroParser

Method GyroParser

JoyShockMapper/src/main.cpp:2630–2657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2628 const bool _always_off;
2629
2630 bool GyroParser(in_string data)
2631 {
2632 if (data.empty())
2633 {
2634 GyroSettings value(_var);
2635 //No assignment? Display current assignment
2636 cout << (value.always_off ? string("GYRO_ON") : string("GYRO_OFF")) << " = " << value << endl;;
2637 }
2638 else
2639 {
2640 stringstream ss(data);
2641 // Read the value
2642 GyroSettings value;
2643 value.always_off = _always_off; // Added line from DefaultParser
2644 ss >> value;
2645 if (!ss.fail())
2646 {
2647 GyroSettings oldVal = _var;
2648 _var = value;
2649 // Command succeeded if the value requested was the current one
2650 // or if the new value is different from the old.
2651 return value == oldVal || _var != oldVal; // Command processed successfully
2652 }
2653 // Couldn't read the value
2654 }
2655 // Not an equal sign? The command is entered wrong!
2656 return false;
2657 }
2658
2659 void DisplayGyroSettingValue(GyroSettings value)
2660 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected