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 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 PER_PIC_SAVE_ADDR 0x009000 // Storage address of each picture
  86. #define PIC_LOGO_ADDR 0x009000 // Logo addr
  87. //#define PIC_DATA_ADDR 0x02F000 //
  88. // TFT35
  89. #define DEFAULT_VIEW_ADDR_TFT35 0xC5800
  90. #define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35+90*1024)
  91. #define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35+80*1024)
  92. #define PIC_DATA_ADDR_TFT35 (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
  93. // TFT32
  94. #define PIC_DATA_ADDR_TFT32 0x02F000
  95. #define PIC_ICON_LOGO_ADDR_TFT32 0x5D8000
  96. #define PIC_OTHER_SIZE_ADDR_TFT32 0x5EE000
  97. // font
  98. #define FONTINFOADDR 0x600000 // 6M -- font addr
  99. #define UNIGBK_FLASH_ADDR (FONTINFOADDR+4096) // 4*1024
  100. #define GBK_FLASH_ADDR (UNIGBK_FLASH_ADDR+180224) // 176*1024
  101. #endif
  102. // Flash flag
  103. #define REFLSHE_FLGA_ADD (0X800000-32)
  104. // SD card information first addr
  105. #define VAR_INF_ADDR 0x000000
  106. #define FLASH_INF_VALID_FLAG 0x20200831
  107. //Store some gcode commands, such as auto leveling commands
  108. #define GCODE_COMMAND_ADDR VAR_INF_ADDR + 3*1024
  109. #define AUTO_LEVELING_COMMAND_ADDR GCODE_COMMAND_ADDR
  110. #define OTHERS_COMMAND_ADDR_1 AUTO_LEVELING_COMMAND_ADDR + 100
  111. #define OTHERS_COMMAND_ADDR_2 OTHERS_COMMAND_ADDR_1 + 100
  112. #define OTHERS_COMMAND_ADDR_3 OTHERS_COMMAND_ADDR_2 + 100
  113. #define OTHERS_COMMAND_ADDR_4 OTHERS_COMMAND_ADDR_3 + 100
  114. #ifdef __cplusplus
  115. extern "C" { /* C-declarations for C++ */
  116. #endif
  117. union union32 {
  118. uint8_t bytes[4];
  119. uint32_t dwords;
  120. };
  121. // pic information
  122. struct pic_msg {
  123. uint8_t name[PIC_NAME_MAX_LEN];
  124. union union32 size;
  125. };
  126. typedef struct pic_msg PIC_MSG;
  127. #define BMP_WRITE_BUF_LEN 512
  128. #define PICINFOADDR 0x1000
  129. #define PIC_SIZE_xM 6
  130. #define FONT_SIZE_xM 2
  131. extern void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff);
  132. extern void Pic_Logo_Read(uint8_t *LogoName,uint8_t *Logo_Rbuff,uint32_t LogoReadsize);
  133. extern void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
  134. extern uint32_t lv_get_pic_addr(uint8_t *Pname);
  135. extern void get_spi_flash_data(const char *rec_buf, int offset, int size);
  136. extern void spi_flash_read_test();
  137. extern void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize);
  138. extern void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize);
  139. #ifdef __cplusplus
  140. } /* C-declarations for C++ */
  141. #endif