LCOV - code coverage report
Current view: top level - home/pbarker/rc/ardupilot/ArduSub - script_button.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 1 1 100.0 %
Date: 2026-09-09 11:02:08 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #if AP_SCRIPTING_ENABLED
       4             : 
       5             : #include <AP_Common/AP_Common.h>
       6             : 
       7             : // Joystick button object for use in Lua scripts.
       8             : //
       9             : // Provide 2 ways to use a joystick button:
      10             : //      is_pressed() returns true if the button is currently (as of the most recent MANUAL_CONTROL msg) pressed
      11             : //      get_and_clear_count() returns the number of times the button was pressed since the last call
      12             : //
      13             : class ScriptButton {
      14             : public:
      15         332 :     ScriptButton(): pressed(false), count(0) {}
      16             : 
      17             :     void press();
      18             : 
      19             :     void release();
      20             : 
      21             :     bool is_pressed() const WARN_IF_UNUSED;
      22             : 
      23             :     uint8_t get_count() const WARN_IF_UNUSED;
      24             : 
      25             :     void clear_count();
      26             : 
      27             :     uint8_t get_and_clear_count();
      28             : 
      29             : private:
      30             :     bool pressed;
      31             :     uint8_t count;
      32             : };
      33             : 
      34             : #endif // AP_SCRIPTING_ENABLED

Generated by: LCOV version 1.14