ソースを参照

Fix compile error in leds.h

Scott Lahteine 5年前
コミット
eeef4e630a
1個のファイルの変更10行の追加0行の削除
  1. 10
    0
      Marlin/src/feature/leds/leds.h

+ 10
- 0
Marlin/src/feature/leds/leds.h ファイルの表示

@@ -27,6 +27,8 @@
27 27
 
28 28
 #include "../../inc/MarlinConfigPre.h"
29 29
 
30
+#include <string.h>
31
+
30 32
 #if ENABLED(NEOPIXEL_LED)
31 33
   #include "neopixel.h"
32 34
 #endif
@@ -45,6 +47,7 @@ typedef struct LEDColor {
45 47
       #endif
46 48
     #endif
47 49
   ;
50
+
48 51
   LEDColor() : r(255), g(255), b(255)
49 52
     #if HAS_WHITE_LED
50 53
       , w(255)
@@ -53,6 +56,7 @@ typedef struct LEDColor {
53 56
       #endif
54 57
     #endif
55 58
   {}
59
+
56 60
   LEDColor(uint8_t r, uint8_t g, uint8_t b
57 61
     #if HAS_WHITE_LED
58 62
       , uint8_t w=0
@@ -68,6 +72,7 @@ typedef struct LEDColor {
68 72
       #endif
69 73
     #endif
70 74
   {}
75
+
71 76
   LEDColor(const uint8_t (&rgbw)[4]) : r(rgbw[0]), g(rgbw[1]), b(rgbw[2])
72 77
     #if HAS_WHITE_LED
73 78
       , w(rgbw[3])
@@ -76,6 +81,7 @@ typedef struct LEDColor {
76 81
       #endif
77 82
     #endif
78 83
   {}
84
+
79 85
   LEDColor& operator=(const uint8_t (&rgbw)[4]) {
80 86
     r = rgbw[0]; g = rgbw[1]; b = rgbw[2];
81 87
     #if HAS_WHITE_LED
@@ -83,15 +89,19 @@ typedef struct LEDColor {
83 89
     #endif
84 90
     return *this;
85 91
   }
92
+
86 93
   LEDColor& operator=(const LEDColor &right) {
87 94
     if (this != &right) memcpy(this, &right, sizeof(LEDColor));
88 95
     return *this;
89 96
   }
97
+
90 98
   bool operator==(const LEDColor &right) {
91 99
     if (this == &right) return true;
92 100
     return 0 == memcmp(this, &right, sizeof(LEDColor));
93 101
   }
102
+
94 103
   bool operator!=(const LEDColor &right) { return !operator==(right); }
104
+
95 105
   bool is_off() const {
96 106
     return 3 > r + g + b
97 107
       #if HAS_WHITE_LED

読み込み中…
キャンセル
保存