Skip to content

Commit

Permalink
Fix DHT11
Browse files Browse the repository at this point in the history
  • Loading branch information
MagoKimbra committed Mar 13, 2018
1 parent c12fbd1 commit 0eec16c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
8 changes: 4 additions & 4 deletions MK4duo/src/feature/dhtsensor/dhtsensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
}

void DhtSensor::init(void) {
HAL::pinMode(pin, OUTPUT_LOW);
HAL::pinMode(pin, OUTPUT);
state = Init;
}

Expand Down Expand Up @@ -106,7 +106,7 @@

case Wait_250ms:
if (millis() - lastOperationTime >= 250) {
HAL::pinMode(pin, OUTPUT_LOW);
HAL::pinMode(pin, OUTPUT);
HAL::digitalWrite(pin, LOW);
state = Wait_20ms;
lastOperationTime = millis();
Expand All @@ -121,13 +121,13 @@
HAL::delayMicroseconds(40);

// Now start reading the data line to get the value from the DHT sensor
HAL::pinMode(pin, INPUT_PULLUP);
HAL::pinMode(pin, INPUT);
HAL::delayMicroseconds(10);

// Read from the DHT sensor using an DHT_ISR
numPulses = 0;
lastPulseTime = 0;
attachInterrupt(pin, DHT_ISR, CHANGE);
attachInterrupt(digitalPinToInterrupt(pin), DHT_ISR, CHANGE);

// Wait for the next operation to complete
state = Read;
Expand Down
2 changes: 1 addition & 1 deletion MK4duo/src/inc/conditionals_pre.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
#endif

#if ENABLED(DOGLCD)
/* Custom characters defined in font dogm_font_data_mk4duo_symbols.h / Marlin_symbols.fon */
/* Custom characters defined in font dogm_font_data_mk4duo_symbols.h / MK4duo_symbols.fon */
// \x00 intentionally skipped to avoid problems in strings
#define LCD_STR_REFRESH "\x01"
#define LCD_STR_FOLDER "\x02"
Expand Down
4 changes: 2 additions & 2 deletions MK4duo/src/lcd/dogm/dogm_font_data_mk4duo_symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/

/**
Fontname: Marlin_symbols
Fontname: MK4duo_symbols
Copyright: Created with Fony 1.4.7
Capital A Height: 0, '1' Height: 0
Calculated Max Values w= 5 h=10 x= 0 y= 3 dx= 6 dy= 0 ascent= 8 len=10
Expand All @@ -32,7 +32,7 @@
Max Font ascent = 8 descent=-2
*/
#include <U8glib.h>
const u8g_fntpgm_uint8_t Marlin_symbols[140] U8G_SECTION(".progmem.Marlin_symbols") = {
const u8g_fntpgm_uint8_t MK4duo_symbols[140] U8G_SECTION(".progmem.MK4duo_symbols") = {
0, 6, 9, 0, 254, 0, 0, 0, 0, 0, 1, 9, 0, 8, 254, 0,
0, 5, 8, 8, 6, 0, 0, 64, 240, 200, 136, 136, 152, 120, 16, 5,
8, 8, 6, 0, 0, 192, 248, 136, 136, 136, 136, 136, 248, 5, 5, 5,
Expand Down
16 changes: 13 additions & 3 deletions MK4duo/src/lcd/ultralcd_impl_DOGM.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
#define FONT_STATUSMENU_NAME FONT_MENU_NAME
#endif

#include "dogm/dogm_font_data_mk4duo_symbols.h" // The Marlin special symbols
#define FONT_SPECIAL_NAME Marlin_symbols
#include "dogm/dogm_font_data_mk4duo_symbols.h" // The MK4duo special symbols
#define FONT_SPECIAL_NAME MK4duo_symbols

#if DISABLED(SIMULATE_ROMFONT)
#if ENABLED(DISPLAY_CHARSET_ISO10646_1)
Expand Down Expand Up @@ -362,12 +362,22 @@ static void lcd_implementation_init() {
OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH);
#endif

#if ENABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306)
SET_OUTPUT(LCD_PINS_DC);
OUT_WRITE(LCD_PINS_RS, LOW);
HAL::delayMilliseconds(500);
WRITE(LCD_PINS_RS, HIGH);
#endif

#if PIN_EXISTS(LCD_RESET)
OUT_WRITE(LCD_RESET_PIN, LOW); // perform a clean hardware reset
HAL::delayMilliseconds(5);
OUT_WRITE(LCD_RESET_PIN, HIGH);
HAL::delayMilliseconds(5); // delay to allow the display to initalize
u8g.begin(); // re-initialize the display
#endif

#if PIN_EXISTS(LCD_RESET) || ENABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306)
u8g.begin();
#endif

#if DISABLED(MINIPANEL) // setContrast not working for Mini Panel
Expand Down
2 changes: 1 addition & 1 deletion fonts/make_fonts.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\bdf2u8g.exe -b 1 -e 9 Marlin_symbols.bdf Marlin_symbols dogm_font_data_Marlin_symbols.h
.\bdf2u8g.exe -b 1 -e 9 MK4duo_symbols.bdf MK4duo_symbols dogm_font_data_MK4duo_symbols.h
.\bdf2u8g.exe -b 16 -e 255 HD44780_W.bdf HD44780_W_5x7 dogm_font_data_HD44780_W.h
.\bdf2u8g.exe -b 32 -e 255 HD44780_C.bdf HD44780_C_5x7 dogm_font_data_HD44780_C.h
.\bdf2u8g.exe -b 32 -e 255 HD44780_J.bdf HD44780_J_5x7 dogm_font_data_HD44780_J.h
Expand Down

0 comments on commit 0eec16c

Please sign in to comment.