![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
AT terminal for the mDot using the USB debug port instead of the serial port.
Dependencies: MTS-Serial libmDot-mbed5
Fork of Dot-AT-Firmware by
CommandTerminal/CmdJoinRx1Offset.cpp@18:f5d28d621bb0, 2018-03-02 (annotated)
- Committer:
- pferland
- Date:
- Fri Mar 02 20:01:38 2018 +0000
- Revision:
- 18:f5d28d621bb0
- Parent:
- 16:d5cf2af81a6d
Added ability to force the AT terminal to use the USB debug port
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mike Fiore |
14:f9a77400b622 | 1 | #include "CmdJoinRx1Offset.h" |
Mike Fiore |
14:f9a77400b622 | 2 | #include "CommandTerminal.h" |
Mike Fiore |
14:f9a77400b622 | 3 | |
Mike Fiore |
14:f9a77400b622 | 4 | CmdJoinRx1Offset::CmdJoinRx1Offset() |
Mike Fiore |
14:f9a77400b622 | 5 | : |
Mike Fiore |
14:f9a77400b622 | 6 | Command("Join Rx1 DR Offset", "AT+JRXO", "Join Rx1 datarate offset", "(US:0-3,AU:0-3,EU:0-5)") { |
Mike Fiore |
14:f9a77400b622 | 7 | |
Mike Fiore |
14:f9a77400b622 | 8 | } |
Mike Fiore |
14:f9a77400b622 | 9 | |
Mike Fiore |
14:f9a77400b622 | 10 | uint32_t CmdJoinRx1Offset::action(std::vector<std::string> args) { |
Mike Fiore |
14:f9a77400b622 | 11 | |
Mike Fiore |
14:f9a77400b622 | 12 | if (args.size() == 1) { |
Mike Fiore |
14:f9a77400b622 | 13 | CommandTerminal::Serial()->writef("%d\r\n", CommandTerminal::Dot()->getJoinRx1DataRateOffset()); |
Mike Fiore |
14:f9a77400b622 | 14 | } |
Mike Fiore |
14:f9a77400b622 | 15 | else if (args.size() == 2) { |
Mike Fiore |
14:f9a77400b622 | 16 | std::string dr = mts::Text::toUpper(args[1]); |
Mike Fiore |
14:f9a77400b622 | 17 | |
Mike Fiore |
14:f9a77400b622 | 18 | int offset = 0; |
Mike Fiore |
14:f9a77400b622 | 19 | sscanf(dr.c_str(), "%d", &offset); |
Mike Fiore |
14:f9a77400b622 | 20 | |
Mike Fiore |
14:f9a77400b622 | 21 | if (CommandTerminal::Dot()->setJoinRx1DataRateOffset(offset) != mDot::MDOT_OK) { |
Mike Fiore |
14:f9a77400b622 | 22 | CommandTerminal::setErrorMessage(CommandTerminal::Dot()->getLastError());; |
Mike Fiore |
14:f9a77400b622 | 23 | return 1; |
Mike Fiore |
14:f9a77400b622 | 24 | } |
Mike Fiore |
14:f9a77400b622 | 25 | } |
Mike Fiore |
14:f9a77400b622 | 26 | |
Mike Fiore |
14:f9a77400b622 | 27 | return 0; |
Mike Fiore |
14:f9a77400b622 | 28 | } |
Mike Fiore |
14:f9a77400b622 | 29 | |
Mike Fiore |
14:f9a77400b622 | 30 | bool CmdJoinRx1Offset::verify(std::vector<std::string> args) { |
Mike Fiore |
14:f9a77400b622 | 31 | if (args.size() == 1) |
Mike Fiore |
14:f9a77400b622 | 32 | return true; |
Mike Fiore |
14:f9a77400b622 | 33 | |
Mike Fiore |
14:f9a77400b622 | 34 | if (args.size() == 2) { |
Mike Fiore |
14:f9a77400b622 | 35 | return true; |
Mike Fiore |
14:f9a77400b622 | 36 | } |
Mike Fiore |
14:f9a77400b622 | 37 | |
Mike Fiore |
14:f9a77400b622 | 38 | CommandTerminal::setErrorMessage("Invalid arguments"); |
Mike Fiore |
14:f9a77400b622 | 39 | return false; |
Mike Fiore |
14:f9a77400b622 | 40 | } |