Explorar el Código

Made i2c mode wok with the hardware I am able to test (ywrobot / sainsmart i2c LCD 2004)

Removed incorrect LiquidCrystal_I2C Library
MendelMax hace 12 años
padre
commit
67710df9f3

+ 0
- 1
ArduinoAddons/Arduino_0.xx/libraries/LiquidCrystal_I2C

@@ -1 +0,0 @@
1
-Subproject commit bfb71c87594ab904db9e41d9f57c6e2df89dc632

+ 0
- 1
ArduinoAddons/Arduino_1.x.x/libraries/LiquidCrystal_I2C

@@ -1 +0,0 @@
1
-Subproject commit bfb71c87594ab904db9e41d9f57c6e2df89dc632

+ 2
- 2
Marlin/Configuration.h Ver fichero

@@ -354,10 +354,10 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
354 354
 //The LCD is attached via an I2C port expander.
355 355
 //#define LCD_I2C
356 356
 #ifdef LCD_I2C
357
-  // Port Expander Type - 0=PCF8574 or 1=MCP23008
357
+  // Port Expander Type - 0=PCF8574 sainsmart/ywrobot
358 358
   #define LCD_I2C_TYPE 0
359 359
   // I2C Address of the port expander
360
-  #define LCD_I2C_ADDRESS 0x20
360
+  #define LCD_I2C_ADDRESS 0x27
361 361
 #endif
362 362
 
363 363
 // Increase the FAN pwm frequency. Removes the PWM noise but increases heating in the FET/Arduino

+ 20
- 4
Marlin/ultralcd_implementation_hitachi_HD44780.h Ver fichero

@@ -11,7 +11,19 @@
11 11
   #define LCD_CLASS LiquidCrystalRus
12 12
 #else
13 13
   #ifdef LCD_I2C
14
+    #if LCD_I2C_TYPE = 0
15
+      #define LCD_I2C_PIN_BL  3
16
+      #define LCD_I2C_PIN_EN  2
17
+      #define LCD_I2C_PIN_RW  1
18
+      #define LCD_I2C_PIN_RS  0
19
+      #define LCD_I2C_PIN_D4  4
20
+      #define LCD_I2C_PIN_D5  5
21
+      #define LCD_I2C_PIN_D6  6
22
+      #define LCD_I2C_PIN_D7  7
23
+    #endif
24
+
14 25
     #include <Wire.h>
26
+    #include <LCD.h>
15 27
     #include <LiquidCrystal_I2C.h>
16 28
     #define LCD_CLASS LiquidCrystal_I2C
17 29
   #else
@@ -32,7 +44,7 @@
32 44
 #define LCD_STR_ARROW_RIGHT "\x7E"  /* from the default character set */
33 45
 
34 46
 #ifdef LCD_I2C
35
-  LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT, LCD_I2C_TYPE);  //address, columns, rows, type
47
+  LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7);
36 48
 #else
37 49
   LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7
38 50
 #endif
@@ -122,11 +134,15 @@ static void lcd_implementation_init()
122 134
         B00000,
123 135
         B00000
124 136
     }; //thanks Sonny Mounicou
137
+
125 138
     #ifdef LCD_I2C
126
-        lcd.init();
127
-    #else
128
-        lcd.begin(LCD_WIDTH, LCD_HEIGHT);
139
+        #ifdef LCD_I2C_PIN_BL
140
+            lcd.setBacklightPin(LCD_I2C_PIN_BL,POSITIVE);
141
+            lcd.setBacklight(HIGH);
142
+        #endif
129 143
     #endif
144
+
145
+    lcd.begin(LCD_WIDTH, LCD_HEIGHT);
130 146
     lcd.createChar(LCD_STR_BEDTEMP[0], bedTemp);
131 147
     lcd.createChar(LCD_STR_DEGREE[0], degree);
132 148
     lcd.createChar(LCD_STR_THERMOMETER[0], thermometer);

Loading…
Cancelar
Guardar