My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pic_manager.h 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. #include "../../../inc/MarlinConfig.h"
  24. #include "../../../libs/W25Qxx.h"
  25. #include <lvgl.h>
  26. #include <stdint.h>
  27. #include <string.h>
  28. #ifndef HAS_SPI_FLASH_FONT
  29. #define HAS_SPI_FLASH_FONT 1 // Disabled until fix the font load code
  30. #endif
  31. #ifndef HAS_GCODE_PREVIEW
  32. #define HAS_GCODE_PREVIEW 1
  33. #endif
  34. #ifndef HAS_LANG_SELECT_SCREEN
  35. #define HAS_LANG_SELECT_SCREEN 1
  36. #endif
  37. #ifndef HAS_BAK_VIEW_IN_FLASH
  38. #define HAS_BAK_VIEW_IN_FLASH 1
  39. #endif
  40. #ifndef HAS_GCODE_DEFAULT_VIEW_IN_FLASH
  41. #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 1
  42. #endif
  43. #ifndef HAS_LOGO_IN_FLASH
  44. #define HAS_LOGO_IN_FLASH 1
  45. #endif
  46. #ifndef SPI_FLASH_SIZE
  47. #define SPI_FLASH_SIZE 0x1000000 // 16MB
  48. #endif
  49. #define PIC_MAX_CN 100 // Maximum number of pictures
  50. #define PIC_NAME_MAX_LEN 50 // Picture name maximum length
  51. #define LOGO_MAX_SIZE_TFT35 (300 * 1024)
  52. #define LOGO_MAX_SIZE_TFT32 (150 * 1024)
  53. #define TITLELOGO_MAX_SIZE (150 * 1024) // Little logo maximum
  54. #define DEFAULT_VIEW_MAX_SIZE (200 * 200 * 2)
  55. #define FLASH_VIEW_MAX_SIZE (200 * 200 * 2)
  56. #define PER_PIC_MAX_SPACE_TFT35 (9 * 1024)
  57. #define PER_PIC_MAX_SPACE_TFT32 (16 * 1024)
  58. #define PER_FONT_MAX_SPACE (16 * 1024)
  59. #if SPI_FLASH_SIZE == 0x200000
  60. // pic
  61. // Robin_pro pic addr
  62. #define PIC_NAME_ADDR 0x001000 // Pic information addr
  63. #define PIC_SIZE_ADDR 0x001800 // Pic size information addr
  64. #define PIC_COUNTER_ADDR 0x002000 // Pic total number
  65. #define PER_PIC_SAVE_ADDR 0x000000 // Storage address of each picture
  66. #define PIC_LOGO_ADDR 0x000000 // Logo addr
  67. #define PIC_DATA_ADDR 0x003000 //
  68. // TFT35
  69. #define DEFAULT_VIEW_ADDR_TFT35 0x1EA070
  70. #define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35 + 90 * 1024)
  71. #define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35 + 80 * 1024)
  72. #define PIC_DATA_ADDR_TFT35 0x003000 // (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
  73. #define PIC_DATA_ADDR_TFT32 0x00F000
  74. #define PIC_ICON_LOGO_ADDR_TFT32 0x5D8000
  75. #define PIC_OTHER_SIZE_ADDR_TFT32 0x5EE000
  76. // font
  77. #define FONTINFOADDR 0x150000 // 6M -- font addr
  78. #define UNIGBK_FLASH_ADDR (FONTINFOADDR + 4096) // 4*1024
  79. #else
  80. // pic
  81. // Robin_pro pic addr
  82. #define PIC_NAME_ADDR 0x003000 // Pic information addr
  83. #define PIC_SIZE_ADDR 0x007000 // Pic size information addr
  84. #define PIC_COUNTER_ADDR 0x008000 // Pic total number
  85. #define PIC_LOGO_ADDR 0x009000 // Logo addr
  86. // TFT35
  87. #define DEFAULT_VIEW_ADDR_TFT35 0xC5800
  88. #define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35 + 90 * 1024)
  89. #define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35 + 80 * 1024)
  90. #define PIC_DATA_ADDR_TFT35 (PIC_ICON_LOGO_ADDR_TFT35 + 350 * 1024) // 0xC5800
  91. // TFT32
  92. #define PIC_DATA_ADDR_TFT32 0x02F000
  93. #define PIC_ICON_LOGO_ADDR_TFT32 0x5D8000
  94. #define PIC_OTHER_SIZE_ADDR_TFT32 0x5EE000
  95. // font
  96. #define FONTINFOADDR 0x600000 // 6M -- font addr
  97. #define UNIGBK_FLASH_ADDR (FONTINFOADDR + 4096) // 4*1024
  98. #define GBK_FLASH_ADDR (UNIGBK_FLASH_ADDR + 180224) // 176*1024
  99. #endif
  100. // Flash flag
  101. #define REFLSHE_FLGA_ADD (0x800000 - 32)
  102. // SD card information first addr
  103. #define VAR_INF_ADDR 0x000000
  104. #define FLASH_INF_VALID_FLAG 0x20201118
  105. // Store some G-code commands, such as auto-leveling commands
  106. #define GCODE_COMMAND_ADDR VAR_INF_ADDR + 3 * 1024
  107. #define AUTO_LEVELING_COMMAND_ADDR GCODE_COMMAND_ADDR
  108. #define OTHERS_COMMAND_ADDR_1 AUTO_LEVELING_COMMAND_ADDR + 100
  109. #define OTHERS_COMMAND_ADDR_2 OTHERS_COMMAND_ADDR_1 + 100
  110. #define OTHERS_COMMAND_ADDR_3 OTHERS_COMMAND_ADDR_2 + 100
  111. #define OTHERS_COMMAND_ADDR_4 OTHERS_COMMAND_ADDR_3 + 100
  112. #ifdef __cplusplus
  113. extern "C" {
  114. #endif
  115. union union32 {
  116. uint8_t bytes[4];
  117. uint32_t dwords;
  118. };
  119. // pic information
  120. struct pic_msg {
  121. uint8_t name[PIC_NAME_MAX_LEN];
  122. union union32 size;
  123. };
  124. typedef struct pic_msg PIC_MSG;
  125. #define BMP_WRITE_BUF_LEN 512
  126. #define PICINFOADDR 0x1000
  127. #define PIC_SIZE_xM 6
  128. #define FONT_SIZE_xM 2
  129. void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff);
  130. void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize);
  131. void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
  132. uint32_t lv_get_pic_addr(uint8_t *Pname);
  133. void get_spi_flash_data(const char *rec_buf, int offset, int size);
  134. void spi_flash_read_test();
  135. void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize);
  136. void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize);
  137. #ifdef __cplusplus
  138. } /* C-declarations for C++ */
  139. #endif