Snorktracker
 All Data Structures Files Functions Variables Macros Pages
Public Member Functions | Protected Attributes
MyGsmPower Class Reference

#include <GsmPower.h>

Public Member Functions

 MyGsmPower (MyData &data, int pin)
 
bool begin ()
 
void on ()
 
void off ()
 

Protected Attributes

MyDatamyData
 Reference to the data.
 
int pinPower
 esp8266 pin connected with pin 5 of the LM2596 modul.
 
long powerOnStartSec
 Timestamp of power on.
 

Detailed Description

Class to switch on/off the DC-DC modul LM2596.

Definition at line 27 of file GsmPower.h.

Constructor & Destructor Documentation

MyGsmPower::MyGsmPower ( MyData data,
int  pin 
)

Constructor

Definition at line 47 of file GsmPower.h.

48  : myData(data)
49  , pinPower(pin)
50  , powerOnStartSec(0)
51 {
52 }
long powerOnStartSec
Timestamp of power on.
Definition: GsmPower.h:33
int pinPower
esp8266 pin connected with pin 5 of the LM2596 modul.
Definition: GsmPower.h:32
MyData & myData
Reference to the data.
Definition: GsmPower.h:30

Member Function Documentation

bool MyGsmPower::begin ( )

Set the pin mode to input -> switch off the DC-DC module

Definition at line 55 of file GsmPower.h.

References MyDbg(), and pinPower.

Referenced by setup().

56 {
57  MyDbg(F("MyGsmPower::begin"));
58  pinMode(pinPower, INPUT);
59  return true;
60 }
int pinPower
esp8266 pin connected with pin 5 of the LM2596 modul.
Definition: GsmPower.h:32
void MyDbg(String info, bool fromWebServer=false, bool newline=true)
Definition: Utils.h:94
void MyGsmPower::off ( )

Switch off the DC-DC module

Definition at line 74 of file GsmPower.h.

References MyData::isPowerOn, myData, MyDbg(), pinPower, powerOnStartSec, MyData::RtcData::powerOnTimeSec, and MyData::rtcData.

Referenced by loop().

75 {
76  MyDbg(F("MyGsmPower::off"));
77  pinMode(pinPower, INPUT);
78  digitalWrite(pinPower, HIGH);
79  myData.rtcData.powerOnTimeSec += millis() / 1000 - powerOnStartSec;
80  myData.isPowerOn = false;
81  powerOnStartSec = 0;
82 }
long powerOnStartSec
Timestamp of power on.
Definition: GsmPower.h:33
class MyData::RtcData rtcData
Data to store in the RTC memory.
int pinPower
esp8266 pin connected with pin 5 of the LM2596 modul.
Definition: GsmPower.h:32
void MyDbg(String info, bool fromWebServer=false, bool newline=true)
Definition: Utils.h:94
long powerOnTimeSec
Time the sim808 is on power without current millis..
Definition: Data.h:38
MyData & myData
Reference to the data.
Definition: GsmPower.h:30
bool isPowerOn
Is the power of the sim808 switched on?
Definition: Data.h:66
void MyGsmPower::on ( )

Switch on the DC-DC module

Definition at line 63 of file GsmPower.h.

References MyData::isPowerOn, myData, MyDbg(), MyDelay(), pinPower, and powerOnStartSec.

Referenced by loop().

64 {
65  MyDbg(F("MyGsmPower::on"));
66  pinMode(pinPower, OUTPUT);
67  digitalWrite(pinPower, LOW);
68  myData.isPowerOn = true;
69  powerOnStartSec = millis() / 1000;
70  MyDelay(1000);
71 }
long powerOnStartSec
Timestamp of power on.
Definition: GsmPower.h:33
int pinPower
esp8266 pin connected with pin 5 of the LM2596 modul.
Definition: GsmPower.h:32
void MyDbg(String info, bool fromWebServer=false, bool newline=true)
Definition: Utils.h:94
MyData & myData
Reference to the data.
Definition: GsmPower.h:30
void MyDelay(long millisDelay)
Definition: Utils.h:104
bool isPowerOn
Is the power of the sim808 switched on?
Definition: Data.h:66

The documentation for this class was generated from the following file: