diff --git a/keyboards/moonlander/cirque_tm040040.c b/keyboards/moonlander/cirque_tm040040.c index 0ba8515beb..88e7e20639 100644 --- a/keyboards/moonlander/cirque_tm040040.c +++ b/keyboards/moonlander/cirque_tm040040.c @@ -1,4 +1,5 @@ // Copyright (c) 2018 Cirque Corp. Restrictions apply. See: www.cirque.com/sw-license +#include "moonlander.h" #include "i2c_master.h" #include "i2c2_master.h" #include "cirque_tm040040.h" @@ -37,7 +38,7 @@ void pointing_device_task(void) { int8_t report_x = 0, report_y = 0; Pinnacle_GetAbsolute(&touchData); - ScaleData(&touchData, 1024, 1024); // Scale coordinates to arbitrary X, Y resolution + ScaleData(&touchData, 256 * keyboard_config.dpi_config, 256 * keyboard_config.dpi_config); // Scale coordinates to arbitrary X, Y resolution if (x && y && touchData.xValue && touchData.yValue) { report_x = (int8_t)(touchData.xValue - x); @@ -72,7 +73,7 @@ void pointing_device_task(void) { rTouchData.xValue = 0; rTouchData.yValue = 0; #endif - process_mouse_user(&report, report_x, report_y); + process_mouse_user(&mouse_report, report_x, report_y); pointing_device_set_report(mouse_report); pointing_device_send(); } diff --git a/keyboards/moonlander/moonlander.c b/keyboards/moonlander/moonlander.c index cf5501c79e..2bd47313c9 100644 --- a/keyboards/moonlander/moonlander.c +++ b/keyboards/moonlander/moonlander.c @@ -466,6 +466,13 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { } return false; #endif + case DPI_CONFIG: + if (record->event.pressed) { + keyboard_config.dpi_config++; + if (!keyboard_config.dpi_config) keyboard_config.dpi_config = 1; + eeconfig_update_kb(keyboard_config.raw); + } + break; } return true; } @@ -478,6 +485,14 @@ void matrix_init_kb(void) { keyboard_config.led_level_res = 0b11; eeconfig_update_kb(keyboard_config.raw); } + +#ifdef POINTING_DEVICE_ENABLE + if (!keyboard_config.dpi_config) { + keyboard_config.dpi_config = 2; + eeconfig_update_kb(keyboard_config.raw); + } +#endif + #ifdef RGB_MATRIX_ENABLE if (keyboard_config.rgb_matrix_enable) { rgb_matrix_set_flags(LED_FLAG_ALL); @@ -493,6 +508,7 @@ void eeconfig_init_kb(void) { // EEPROM is getting reset! keyboard_config.rgb_matrix_enable = true; keyboard_config.led_level = true; keyboard_config.led_level_res = 0b11; + keyboard_config.dpi_config = 2; eeconfig_update_kb(keyboard_config.raw); eeconfig_init_user(); } diff --git a/keyboards/moonlander/moonlander.h b/keyboards/moonlander/moonlander.h index 16c6859613..6b6cfc26d8 100644 --- a/keyboards/moonlander/moonlander.h +++ b/keyboards/moonlander/moonlander.h @@ -63,16 +63,18 @@ extern bool mcp23018_leds[]; enum planck_ez_keycodes { TOGGLE_LAYER_COLOR = SAFE_RANGE, LED_LEVEL, + DPI_CONFIG, ML_SAFE_RANGE, }; typedef union { uint32_t raw; struct { - bool disable_layer_led :1; - bool rgb_matrix_enable :1; - bool led_level :1; - uint8_t led_level_res :2; // DO NOT REMOVE + bool disable_layer_led :1; + bool rgb_matrix_enable :1; + bool led_level :1; + uint8_t led_level_res :2; // DO NOT REMOVE + uint8_t dpi_config :3; }; } keyboard_config_t;