Browse Source

Adherence to the new OOP coding standards

João Brázio 8 years ago
parent
commit
7c7e30f4cc
No account linked to committer's email address
4 changed files with 24 additions and 24 deletions
  1. 1
    1
      Marlin/Marlin.h
  2. 7
    7
      Marlin/Marlin_main.cpp
  3. 12
    12
      Marlin/stopwatch.cpp
  4. 4
    4
      Marlin/stopwatch.h

+ 1
- 1
Marlin/Marlin.h View File

@@ -360,7 +360,7 @@ extern bool axis_homed[3]; // axis[n].is_homed
360 360
 #endif
361 361
 
362 362
 // Print job timer
363
-extern stopwatch print_job_timer;
363
+extern Stopwatch print_job_timer;
364 364
 
365 365
 // Handling multiple extruders pins
366 366
 extern uint8_t active_extruder;

+ 7
- 7
Marlin/Marlin_main.cpp View File

@@ -298,7 +298,7 @@ const int sensitive_pins[] = SENSITIVE_PINS; ///< Sensitive pin list for M42
298 298
 millis_t previous_cmd_ms = 0;
299 299
 static millis_t max_inactive_time = 0;
300 300
 static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000L;
301
-stopwatch print_job_timer = stopwatch();
301
+Stopwatch print_job_timer = Stopwatch();
302 302
 static uint8_t target_extruder;
303 303
 
304 304
 #if ENABLED(AUTO_BED_LEVELING_FEATURE)
@@ -4119,17 +4119,17 @@ inline void gcode_M104() {
4119 4119
     #endif
4120 4120
 
4121 4121
     /**
4122
-     * We use halve EXTRUDE_MINTEMP here to allow nozzles to be put into hot
4122
+     * We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot
4123 4123
      * stand by mode, for instance in a dual extruder setup, without affecting
4124 4124
      * the running print timer.
4125 4125
      */
4126
-    if (temp <= (EXTRUDE_MINTEMP/2)) {
4126
+    if (temp <= (EXTRUDE_MINTEMP)/2) {
4127 4127
       print_job_timer.stop();
4128 4128
       LCD_MESSAGEPGM(WELCOME_MSG);
4129 4129
     }
4130 4130
     /**
4131 4131
      * We do not check if the timer is already running because this check will
4132
-     * be done for us inside the stopwatch::start() method thus a running timer
4132
+     * be done for us inside the Stopwatch::start() method thus a running timer
4133 4133
      * will not restart.
4134 4134
      */
4135 4135
     else print_job_timer.start();
@@ -4273,17 +4273,17 @@ inline void gcode_M109() {
4273 4273
     #endif
4274 4274
 
4275 4275
     /**
4276
-     * We use halve EXTRUDE_MINTEMP here to allow nozzles to be put into hot
4276
+     * We use half EXTRUDE_MINTEMP here to allow nozzles to be put into hot
4277 4277
      * stand by mode, for instance in a dual extruder setup, without affecting
4278 4278
      * the running print timer.
4279 4279
      */
4280
-    if (temp <= (EXTRUDE_MINTEMP/2)) {
4280
+    if (temp <= (EXTRUDE_MINTEMP)/2) {
4281 4281
       print_job_timer.stop();
4282 4282
       LCD_MESSAGEPGM(WELCOME_MSG);
4283 4283
     }
4284 4284
     /**
4285 4285
      * We do not check if the timer is already running because this check will
4286
-     * be done for us inside the stopwatch::start() method thus a running timer
4286
+     * be done for us inside the Stopwatch::start() method thus a running timer
4287 4287
      * will not restart.
4288 4288
      */
4289 4289
     else print_job_timer.start();

+ 12
- 12
Marlin/stopwatch.cpp View File

@@ -23,28 +23,28 @@
23 23
 #include "Marlin.h"
24 24
 #include "stopwatch.h"
25 25
 
26
-stopwatch::stopwatch() {
26
+Stopwatch::Stopwatch() {
27 27
    this->reset();
28 28
  }
29 29
 
30
-void stopwatch::stop() {
31
-  if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("stopwatch::stop()");
30
+void Stopwatch::stop() {
31
+  if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("Stopwatch::stop()");
32 32
   if (!this->isRunning()) return;
33 33
 
34 34
   this->status = STPWTCH_STOPPED;
35 35
   this->stopTimestamp = millis();
36 36
 }
37 37
 
38
-void stopwatch::pause() {
39
-  if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("stopwatch::pause()");
38
+void Stopwatch::pause() {
39
+  if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("Stopwatch::pause()");
40 40
   if (!this->isRunning()) return;
41 41
 
42 42
   this->status = STPWTCH_PAUSED;
43 43
   this->stopTimestamp = millis();
44 44
 }
45 45
 
46
-void stopwatch::start() {
47
-  if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("stopwatch::start()");
46
+void Stopwatch::start() {
47
+  if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("Stopwatch::start()");
48 48
   if (this->isRunning()) return;
49 49
 
50 50
   if (this->isPaused()) this->accumulator = this->duration();
@@ -54,8 +54,8 @@ void stopwatch::start() {
54 54
   this->startTimestamp = millis();
55 55
 }
56 56
 
57
-void stopwatch::reset() {
58
-  if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("stopwatch::reset()");
57
+void Stopwatch::reset() {
58
+  if (DEBUGGING(INFO)) SERIAL_ECHOLNPGM("Stopwatch::reset()");
59 59
 
60 60
   this->status = STPWTCH_STOPPED;
61 61
   this->startTimestamp = 0;
@@ -63,15 +63,15 @@ void stopwatch::reset() {
63 63
   this->accumulator = 0;
64 64
 }
65 65
 
66
-bool stopwatch::isRunning() {
66
+bool Stopwatch::isRunning() {
67 67
   return (this->status == STPWTCH_RUNNING) ? true : false;
68 68
 }
69 69
 
70
-bool stopwatch::isPaused() {
70
+bool Stopwatch::isPaused() {
71 71
   return (this->status == STPWTCH_PAUSED) ? true : false;
72 72
 }
73 73
 
74
-uint16_t stopwatch::duration() {
74
+uint16_t Stopwatch::duration() {
75 75
   return (((this->isRunning()) ? millis() : this->stopTimestamp)
76 76
           - this->startTimestamp) / 1000 + this->accumulator;
77 77
 }

+ 4
- 4
Marlin/stopwatch.h View File

@@ -23,7 +23,7 @@
23 23
 #ifndef STOPWATCH_H
24 24
 #define STOPWATCH_H
25 25
 
26
-enum stopwatch_s {
26
+enum StopwatchStatus {
27 27
   STPWTCH_STOPPED = 0x0,
28 28
   STPWTCH_RUNNING = 0x1,
29 29
   STPWTCH_PAUSED  = 0x2
@@ -34,9 +34,9 @@ enum stopwatch_s {
34 34
  * @details This class acts as a timer proving stopwatch functionality including
35 35
  * the ability to pause the running time counter.
36 36
  */
37
-class stopwatch {
37
+class Stopwatch {
38 38
   private:
39
-    stopwatch_s status;
39
+    StopwatchStatus status;
40 40
     uint16_t accumulator;
41 41
     uint32_t startTimestamp;
42 42
     uint32_t stopTimestamp;
@@ -45,7 +45,7 @@ class stopwatch {
45 45
     /**
46 46
      * @brief Class constructor
47 47
      */
48
-    stopwatch();
48
+    Stopwatch();
49 49
 
50 50
     /**
51 51
      * @brief Stops the stopwatch

Loading…
Cancel
Save