Revision 61b0791a devices/PowerManagement/main.cpp
devices/PowerManagement/main.cpp | ||
---|---|---|
858 | 858 |
return; |
859 | 859 |
} |
860 | 860 |
|
861 |
void shellRequestWiiSteering(BaseSequentialStream* chp, int argc, char *argv[]) { |
|
862 |
// if Wii steering is currently active, stop it |
|
863 |
if (global.userThread.getCurrenState() == UserThread::WII_STEERING) { |
|
864 |
global.userThread.setNextState(UserThread::IDLE); |
|
865 |
} |
|
866 |
// check arguments and (try to) enable Wii steering |
|
867 |
else { |
|
868 |
// if arguments invalid |
|
869 |
if (argc < 1 || argc > 2 || global.userThread.setWiiAddress(argv[0]) != RDY_OK) { |
|
870 |
chprintf(chp, "Warning: invalid arguments\n"); |
|
871 |
chprintf(chp, "Usage: %s\n", "wii_steering <address> [<deadzone>]"); |
|
872 |
chprintf(chp, "\n"); |
|
873 |
chprintf(chp, "\taddress\n"); |
|
874 |
chprintf(chp, "bluetooth address of the Wiimote controller to pair with.\n"); |
|
875 |
chprintf(chp, "\tdeadzone\n"); |
|
876 |
chprintf(chp, "deadzone to set for the Wiimote controller [default = 10%%].\n"); |
|
877 |
return; |
|
878 |
} |
|
879 |
else { |
|
880 |
// set deadzone |
|
881 |
const float deadzone = global.userThread.setWiiDeadzone((argc == 2) ? std::atof(argv[1]) : 0.1f); |
|
882 |
chprintf(chp, "deadzone set to %u%%\n", (unsigned int)(deadzone * 100.0f)); |
|
883 |
|
|
884 |
// start Wii steering behaviour |
|
885 |
global.userThread.setNextState(UserThread::WII_STEERING); |
|
886 |
} |
|
887 |
} |
|
888 |
return; |
|
889 |
} |
|
890 |
|
|
861 | 891 |
static const ShellCommand commands[] = { |
862 | 892 |
{"shutdown", shellRequestShutdown}, |
863 | 893 |
{"check", shellRequestCheck}, |
... | ... | |
876 | 906 |
{"print_vcnl", shellRequestPrintVCNL}, |
877 | 907 |
{"shell_board", shellSwitchBoardCmd}, |
878 | 908 |
{"get_bootloader_info", shellRequestGetBootloaderInfo}, |
909 |
{"wii_steering", shellRequestWiiSteering}, |
|
879 | 910 |
{NULL, NULL} |
880 | 911 |
}; |
881 | 912 |
|
Also available in: Unified diff