Skip to content

Commit

Permalink
Fixed num_tools, added TFT-ER pin numbers, rearranged machine gui
Browse files Browse the repository at this point in the history
  • Loading branch information
seeul8er committed May 24, 2020
1 parent 6dde4e1 commit 690f493
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 33 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,25 @@ case you use different hardware or want a different pin connection layout

Check out [releases](https://github.com/seeul8er/RepPanel_ESP32/releases) for compiled binaries.

### Wiring ER-TFTM035-6 to the ESP32 DevKit with 36GPIOs
### Wiring ER-TFTM035-6 to the ESP32 DevKit

**Beware:** The available development boards have different pin configurations. Some have GND & 3.3V at the bottom. Others at the top.
![ESP32 Devkit wire connections](wiki/Wiring_ESP32_DevKit_38GPIOs.jpg)
![ER-TFTM035-6 wiring](wiki/Wiring_ERTFT.jpg)

Pin configuration of ready made images:
| **Pin Number** | **Function** | **Description** |
|:--------------: |:------------: |:-------------------------: |
| GPIO 13 | MOSI | Data line to TFT |
| GPIO 14 | SCL | SPI CLK for TFT |
| GPIO 15 | Slave Select | SPI |
| GPIO 22 | SCL | I²C - touch |
| GPIO 21 | SDA | I²C - touch |
| GPIO 4 | Reset | TFT related |
| GPIO 2 | Data | TFT related |
| GPIO 27 | Backlight | Turn on/off TFT backlight |
| GPIO 17 | UART TX | Connect to RX PanelDue port |
| GPIO 16 | UART RX | Connect to TX PanelDue port |
| **Pin Number ESP32 ** | **Pin Number ER-TFTM035-6** | **Function** | **Description** |
|:--------------:|:--:|:------------: |:-------------------------: |
| VCC 3.3V | 2 | Power supply | Match TFT voltage with ESP32 pin |
| GND | 1 | GND | Ground |
| GPIO 13 | 27 | MOSI | Data line to TFT |
| GPIO 14 | 24 | SCL | SPI CLK for TFT |
| GPIO 15 | 23 | Slave Select | SPI |
| GPIO 22 | 30 | SCL | I²C - touch |
| GPIO 21 | 31 | SDA | I²C - touch |
| GPIO 4 | 21 | Reset | TFT related |
| GPIO 2 | 25 | Data | TFT related |
| GPIO 27 | 29 | Backlight | Turn on/off TFT backlight |
| GPIO 17 | - | UART TX | Connect to RX PanelDue port |
| GPIO 16 | - | UART RX | Connect to TX PanelDue port |

## Screenshots
![RepPanel with case](wiki/RepPanel_with_case.png)
Expand Down
2 changes: 1 addition & 1 deletion main/reppanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extern "C" {

#define VERSION_MAJOR 1
#define VERSION_MINOR 0
#define VERSION_HOTFIX 0
#define VERSION_HOTFIX 1

#define NUM_TEMPS_BUFF 15
#define MAX_FILA_NAME_LEN 32
Expand Down
22 changes: 11 additions & 11 deletions main/reppanel_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,17 @@ void draw_machine(lv_obj_t *parent_screen) {
lv_page_set_scrl_fit2(machine_page, LV_FIT_FILL, LV_FIT_FILL);
lv_page_set_scrl_layout(machine_page, LV_LAYOUT_COL_M);

lv_obj_t *home_cont = lv_cont_create(machine_page, NULL);
lv_cont_set_layout(home_cont, LV_LAYOUT_ROW_M);
lv_cont_set_fit(home_cont, LV_FIT_TIGHT);
lv_obj_t *label_home = lv_label_create(home_cont, NULL);
lv_label_set_text(label_home, "Home:");
btn_home_all = create_button(home_cont, btn_home_all, " All Axis ", _home_all_event);
btn_home_x = create_button(home_cont, btn_home_x, " X ", _home_x_event);
btn_home_y = create_button(home_cont, btn_home_y, " Y ", _home_y_event);
btn_home_z = create_button(home_cont, btn_home_z, " Z ", _home_z_event);
lv_style_copy(&not_homed_style, lv_btn_get_style(btn_home_x, LV_BTN_STYLE_REL));

lv_obj_t *cont_cali = lv_cont_create(machine_page, NULL);
lv_cont_set_fit(cont_cali, LV_FIT_TIGHT);
lv_cont_set_layout(cont_cali, LV_LAYOUT_ROW_M);
Expand All @@ -234,16 +245,5 @@ void draw_machine(lv_obj_t *parent_screen) {
static lv_obj_t *do_cali_butn;
create_button(cont_cali, do_cali_butn, "Start", _start_cali_event);

lv_obj_t *home_cont = lv_cont_create(machine_page, NULL);
lv_cont_set_layout(home_cont, LV_LAYOUT_ROW_M);
lv_cont_set_fit(home_cont, LV_FIT_TIGHT);
lv_obj_t *label_home = lv_label_create(home_cont, NULL);
lv_label_set_text(label_home, "Home:");
btn_home_all = create_button(home_cont, btn_home_all, " All Axis ", _home_all_event);
btn_home_x = create_button(home_cont, btn_home_x, " X ", _home_x_event);
btn_home_y = create_button(home_cont, btn_home_y, " Y ", _home_y_event);
btn_home_z = create_button(home_cont, btn_home_z, " Z ", _home_z_event);
lv_style_copy(&not_homed_style, lv_btn_get_style(btn_home_x, LV_BTN_STYLE_REL));

update_ui_machine();
}
6 changes: 3 additions & 3 deletions main/reppanel_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ lv_obj_t *popup_page;
lv_obj_t *ddlist_selected_filament;
static lv_obj_t *cont_filament;

int num_tools = 0;
int num_tools = 1;
reprap_tool_t reprap_tools[MAX_NUM_TOOLS];
reprap_bed_t reprap_bed;
reprap_tool_poss_temps_t reprap_tool_poss_temps;
Expand Down Expand Up @@ -177,14 +177,14 @@ static void unload_filament_event_handler(lv_obj_t *obj, lv_event_t event) {

static void send_deactivate_bed_heater() {
char gcode_buff[64];
ESP_LOGI(TAG, "\tDeactivating bed heater\n");
ESP_LOGI(TAG, "\tDeactivating bed heater");
sprintf(gcode_buff, "M140 P%i S-273.15", reprap_bed.heater_indx);
reprap_send_gcode(gcode_buff);
}

static void send_deactivate_tool_heater() {
char gcode_buff[64];
ESP_LOGI(TAG, "\tDeactivating tool %i heater\n", current_visible_tool_indx);
ESP_LOGI(TAG, "\tDeactivating tool %i heater", current_visible_tool_indx);
sprintf(gcode_buff, "G10 P%i S-273.15 R-273.15", reprap_tools[current_visible_tool_indx].number);
reprap_send_gcode(gcode_buff);
}
Expand Down
5 changes: 2 additions & 3 deletions main/reppanel_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ void process_reprap_status(char *buff) {
}
}
num_heaters = pos;
num_tools = pos - 1; // best guess: (number of heaters - bed heater) = number of tools

cJSON *duet_seq = cJSON_GetObjectItem(root, "seq"); // Get seq number
if (duet_seq && cJSON_IsNumber(duet_seq)) {
Expand Down Expand Up @@ -243,8 +242,8 @@ void process_reprap_status(char *buff) {
pos++;
}
}
got_extended_status = true; // TODO: Not the same for WiFi and UART autoremove
num_tools = pos;
got_extended_status = true;
num_tools = pos; // update number of tools
}

// Get firmware information
Expand Down

0 comments on commit 690f493

Please sign in to comment.