DM-1701 screen clipping

ct1esj
Posts: 17
Joined: Sun Jun 12, 2022 12:43 pm

Re: DM-1701 screen clipping

Post by ct1esj » Thu Jan 25, 2024 4:51 pm

HA5DS wrote:
Tue Jan 23, 2024 11:07 pm
Now that the source code if available I could finally do it, the radio feels so much better to use.

Since the DM-1701 does not have GPS, and the GPS status does not needs to be displayed in the status bar, I could make all fields a little more spacious.

The DM-1701 has a very big display compared to the other radios, so the Channel display had plenty room even if I added 12 pixels at the top. I just had to rearrange some elements. I did not touched the menu and other pages, I think that can be skipped, but the channel screen was very important, now I think it's so much better.

1701_dmr_after3.png
Can you send me the firmware so I can test it on mine?
My e-mail is ok on qrz.com

HA5DS
Posts: 24
Joined: Tue Sep 19, 2023 8:02 pm

Re: DM-1701 screen clipping

Post by HA5DS » Thu Jan 25, 2024 5:46 pm

F1RMB wrote:
Thu Jan 25, 2024 4:29 pm
Because you RSSI bar is below the 16th pixel line, hence the 200ms update for that part won't be correctly rendered when the RSSI bar moves up and down quickly, and in some occasion some stuff will overlap on screen (in a pretty ugly way ;) )..
I would send you a video of my radio which shows that the RSSI bar does not jump to anywhere, it stays put and updates just fine, but since you already decided that it is not possible, I will not bother... :D

User avatar
F1RMB
Posts: 2624
Joined: Sat Nov 16, 2019 5:42 am
Location: Grenoble, France

Re: DM-1701 screen clipping

Post by F1RMB » Thu Jan 25, 2024 5:53 pm

I never wrote that is not possible, I told you multiple time you have to take care about the rendering, and the way you moved the vertical offset of the header is WRONG.

I'm not interested in your video, I've spent enough time in the code (many years) that I could warn you about possible problems, it's up to you to listen and learn how the code works, or not.

This is my final post about this subject, I won't waste more time about this topic.

HA5DS
Posts: 24
Joined: Tue Sep 19, 2023 8:02 pm

Re: DM-1701 screen clipping

Post by HA5DS » Thu Jan 25, 2024 5:57 pm

F1RMB wrote:
Thu Jan 25, 2024 5:53 pm
I never wrote that is not possible, I told you multiple time you have to take care about the rendering, and the way you moved the vertical offset of the header is WRONG.
It's not WRONG...
Why do you refuse to understand, that it's not the only thing I did? Also take care how many rows we need to render in every point in to code when we render anything to the display?

VK3KYY
Posts: 7590
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: DM-1701 screen clipping

Post by VK3KYY » Thu Jan 25, 2024 8:54 pm

You are doing things completely the wrong way.

I just modifying a few things in the code and have shifted the whole display down 8 lines

There may even be a simpler way than what I've done because the display controller supports scrolling
https://www.crystalfontz.com/controller ... 8353-E/93/

But that would take longer to investigate.


Anyway. I changed a few lines of code e.g.

Code: Select all

#if defined(PLATFORM_DM1701)
#define DISPLAY_SIZE_Y                          120
#else
#define DISPLAY_SIZE_Y                          128
#endif
Changed the display rendering code slightly so the start line and end line , in the command to the didplay controller are increased by 8

Code: Select all

	// Set start and end rows of the transfer
	{
#if defined(PLATFORM_DM1701)		
		uint8_t opts[] = { 0x00, startRow + 8, 0x00, endRow + 8 };
#else
		uint8_t opts[] = { 0x00, startRow, 0x00, endRow };
#endif		
		displayWriteCmds(HX8583_CMD_RASET, sizeof(opts), opts);
	}

Edit.
I need to update the code that handles the screengrab, to put black at the top, but it looks like it needs a bit more work.

Number of items on Zone list also would need to be changed

Anyway.

I do NOT have time to do this now.

I'm working on the MD2017 Beta release

Please do this youself

Anyway..



vfo.png
vfo.png (3.55 KiB) Viewed 519 times
sweepscan.png
sweepscan.png (5.67 KiB) Viewed 519 times
channel.png
channel.png (3.45 KiB) Viewed 519 times
Position of Zone just needs to be moved up
menu.png
menu.png (3.87 KiB) Viewed 519 times
Number of menu items needs to be decreased
satellite_list.png
satellite_list.png (5.94 KiB) Viewed 519 times
Number of satellites in the list needs to be reduced
Attachments
satellite_page_1.png
satellite_page_1.png (4.72 KiB) Viewed 519 times

HA5DS
Posts: 24
Joined: Tue Sep 19, 2023 8:02 pm

Re: DM-1701 screen clipping

Post by HA5DS » Thu Jan 25, 2024 9:27 pm

VK3KYY wrote:
Thu Jan 25, 2024 8:54 pm
You are doing things completely the wrong way.
Tell me, if modify the code so the text positions will be more suitable for the DM-1701:

Code: Select all

#elif defined(PLATFORM_MD380) || defined(PLATFORM_MDUV380) || defined(PLATFORM_MD2017)
#define DISPLAY_Y_POS_HEADER                   2
#define DISPLAY_Y_POS_BAR                     10
[...]
#elif defined(PLATFORM_DM1701)
#define DISPLAY_Y_POS_HEADER                   13
#define DISPLAY_Y_POS_BAR                     22
[...]
#elif
And change which rows needs to be rendered:

Code: Select all

					uiUtilityRenderHeader(false, false);
#if defined(PLATFORM_DM1701)
					displayRenderRows(1, 4);
#else
					displayRenderRows(0, 2);
#endif
How is this completely wrong?

Your solution is to shift the display down 8 pixels, in my opinion that is what's completely wrong.
That way the bottom pixels of the zone display are clipped, also the menu display is worse, etc. I don't see how it's better.
Also the bezel on the DM-1701 also limits the visibility of the first and last couple columns on the left and right. By adjusting the text positions that can be addressed as well. And this way, everything is positioned correctly, nothing is clipped, everything is centered and evenly spaces to each other. I'm very happy with this solution, but if you feel it's completely wrong, I'm sorry I wasted your time.

HA5DS
Posts: 24
Joined: Tue Sep 19, 2023 8:02 pm

Re: DM-1701 screen clipping

Post by HA5DS » Thu Jan 25, 2024 9:30 pm

ct1esj wrote:
Thu Jan 25, 2024 4:51 pm
Can you send me the firmware so I can test it on mine?
My e-mail is ok on qrz.com
Unfortunately, since the author of the firmware feels that the way I modified the code is completely wrong, I cannot send you my modified version in good conscience. :(
You will need to wait for an official fix for this issue.

VK3KYY
Posts: 7590
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: DM-1701 screen clipping

Post by VK3KYY » Thu Jan 25, 2024 9:31 pm

Becasue you don't need to modify all that stuff

Just move the whole display down 8 lines

Look at the code I posted, it shows how to move everything down 8 lines.

Even better read the data sheet for the LCD controller and work out how to get it to shift the whole display down 8 lines


I've also now realised there would need to be a separate build for the Retevis RT-84, becuase its the same radio except the case has a larger window over the LCD panel, so these changes are not needed and would not be good for that radio, becuase it reduces the number of menu lines everywhere else that has a list if items that no longer fits etc.

But adding a new build platform is time consuming, as you have to look for every line in the code that has PLATFORM_DM1701 and add PLATFORM_RT84 apart from the places which affect the display

VK3KYY
Posts: 7590
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: DM-1701 screen clipping

Post by VK3KYY » Thu Jan 25, 2024 9:39 pm

Here is my diff from the released version, except it may also include references to MD2017 which I am about to release, (hence why I do not have time to work on this at the moment)

Code: Select all

diff --git a/MDUV380_firmware/application/include/hardware/HX8353E.h b/MDUV380_firmware/application/include/hardware/HX8353E.h
index 684e3b9..c4da47c 100644
--- a/MDUV380_firmware/application/include/hardware/HX8353E.h
+++ b/MDUV380_firmware/application/include/hardware/HX8353E.h
@@ -167,7 +167,11 @@ extern uint16_t themeItems[NIGHT + 1][THEME_ITEM_MAX]; // Theme storage
 #define FONT_SIZE_2_HEIGHT                       8
 #define FONT_SIZE_3_HEIGHT                       16
 #define FONT_SIZE_4_HEIGHT                       32
+#if defined(PLATFORM_DM1701)
+#define DISPLAY_SIZE_Y                          120
+#else
 #define DISPLAY_SIZE_Y                          128
+#endif
 #define DISPLAY_SIZE_X                          160
 #define DISPLAY_NUMBER_OF_ROWS  (DISPLAY_SIZE_Y / 8)

diff --git a/MDUV380_firmware/application/source/hardware/HX8353E_display.c b/MDUV380_firmware/application/source/hardware/HX8353E_display.c
index 8fe9520..810d940 100644
--- a/MDUV380_firmware/application/source/hardware/HX8353E_display.c
+++ b/MDUV380_firmware/application/source/hardware/HX8353E_display.c
@@ -1227,6 +1227,7 @@ static void dmaCompleteCallback(DMA_HandleTypeDef *hdma)
 }
 #endif

+
 void displayRenderRows(int16_t startRow, int16_t endRow)
 {
        GPIO_InitTypeDef GPIO_InitStruct = {0};
@@ -1251,7 +1252,11 @@ void displayRenderRows(int16_t startRow, int16_t endRow)

        // Set start and end rows of the transfer
        {
+#if defined(PLATFORM_DM1701)
+               uint8_t opts[] = { 0x00, startRow + 8, 0x00, endRow + 8 };
+#else
                uint8_t opts[] = { 0x00, startRow, 0x00, endRow };
+#endif
                displayWriteCmds(HX8583_CMD_RASET, sizeof(opts), opts);
        }

diff --git a/MDUV380_firmware/application/source/io/display.c b/MDUV380_firmware/application/source/io/display.c
index e8dbd44..c10d526 100644
--- a/MDUV380_firmware/application/source/io/display.c
+++ b/MDUV380_firmware/application/source/io/display.c
@@ -369,7 +369,7 @@ void displayInit(bool isInverted, bool SPIFlashAvailable)
        }

        {
-               uint8_t opts[] = { 0x00, 0x00, 0x00, DISPLAY_SIZE_Y};
+               uint8_t opts[] = { 0x00, 0x00, 0x00, DISPLAY_SIZE_Y + 8};
                displayWriteCmds(HX8583_CMD_RASET, sizeof(opts), opts);
        }

@@ -389,6 +389,46 @@ void displayInit(bool isInverted, bool SPIFlashAvailable)
        displayBegin(isInverted, SPIFlashAvailable);

        displayClearBuf();
+
+       //void initDisplay(void)
+       {
+               GPIO_InitTypeDef GPIO_InitStruct = {0};
+
+               // GD77 display controller has 8 lines per row.
+               // Display shares its pins with the keypad, so the pind need to be put into alternate mode to work with the FSMC
+               GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+               GPIO_InitStruct.Pull = GPIO_NOPULL;
+               GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+               GPIO_InitStruct.Alternate = GPIO_AF12_FSMC;
+
+               GPIO_InitStruct.Pin = LCD_D0_Pin | LCD_D1_Pin | LCD_D2_Pin | LCD_D3_Pin;
+               HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
+
+               GPIO_InitStruct.Pin = LCD_D4_Pin | LCD_D5_Pin | LCD_D6_Pin | LCD_D7_Pin;
+               HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
+
+               HAL_GPIO_WritePin(LCD_CS_GPIO_Port, LCD_CS_Pin, GPIO_PIN_RESET);
+
+               // Set start and end rows of the transfer
+               {
+                       uint8_t opts[] = { 0x00, 0, 0x00, 128 };
+                       displayWriteCmds(HX8583_CMD_RASET, sizeof(opts), opts);
+               }
+
+               displayWriteCmd(HX8583_CMD_RAMWR);
+
+               // fallback
+               for(int y = 0; y < (128) * DISPLAY_SIZE_X * sizeof(uint16_t); y++)
+               {
+                       *((volatile uint8_t*) LCD_FSMC_ADDR_DATA) = 0x00;
+               }
+
+               HAL_GPIO_WritePin(LCD_CS_GPIO_Port, LCD_CS_Pin, GPIO_PIN_SET);
+
+               *((volatile uint8_t*) LCD_FSMC_ADDR_DATA) = 0;// write 0 to the display pins , to pull them all low, so keyboard reads don't need to
+       }
+
+
        displayRender();
 }

diff --git a/MDUV380_firmware/application/source/usb/usb_com.c b/MDUV380_firmware/application/source/usb/usb_com.c
index c2fe1a9..4e8f736 100644
--- a/MDUV380_firmware/application/source/usb/usb_com.c
+++ b/MDUV380_firmware/application/source/usb/usb_com.c
@@ -220,7 +220,19 @@ static void cpsHandleReadCommand(void)

                case CPS_ACCESS_DISPLAY_BUFFER:
                        rxPowerSavingSetState(ECOPHASE_POWERSAVE_INACTIVE); // Avoiding going into a state that USB doesn't work.
-                       memcpy((uint8_t *)&usbComSendBuf[3], (uint8_t *)displayGetPrimaryScreenBuffer() + address, length);
+                       {
+                               static uint16_t tmp[DISPLAY_SIZE_X *  8];
+                               memset(tmp,0x00,DISPLAY_SIZE_X * 8 * sizeof(uint16_t));
+                               if (address < 8 * 160 * 2)
+                               {
+                                       memcpy((uint8_t *)&usbComSendBuf[3], (uint8_t *)tmp, length);
+                               }
+                               else
+                               {
+                                       memcpy((uint8_t *)&usbComSendBuf[3], (uint8_t *)displayGetPrimaryScreenBuffer() + address - (8 * 160 * 2), length);
+                               }
+
+                       }
                        result = true;
                        break;

diff --git a/MDUV380_firmware/application/source/user_interface/menuSatelliteScreen.c b/MDUV380_firmware/application/source/user_interface/menuSatelliteScreen.c
index 071dbf4..65c264b 100644
--- a/MDUV380_firmware/application/source/user_interface/menuSatelliteScreen.c
+++ b/MDUV380_firmware/application/source/user_interface/menuSatelliteScreen.c
@@ -45,8 +45,10 @@

 #if defined(PLATFORM_RD5R)
 #define NUM_PASSES_TO_DISPLAY_ON_LIST_SCREEN 2
-#elif defined(PLATFORM_MDUV380) || defined(PLATFORM_MD380) || defined(PLATFORM_DM1701) || defined(PLATFORM_MD2017)
+#elif defined(PLATFORM_MDUV380) || defined(PLATFORM_MD380) || defined(PLATFORM_MD2017)
 #define NUM_PASSES_TO_DISPLAY_ON_LIST_SCREEN 6
+#elif defined(PLATFORM_DM1701)
+#define NUM_PASSES_TO_DISPLAY_ON_LIST_SCREEN 5
 #else
 #define NUM_PASSES_TO_DISPLAY_ON_LIST_SCREEN 3
 #endif

VK3KYY
Posts: 7590
Joined: Sat Nov 16, 2019 3:25 am
Location: Melbourne, Australia

Re: DM-1701 screen clipping

Post by VK3KYY » Thu Jan 25, 2024 9:47 pm

Edit. I just read the LCD panel datasheet and I'm not sure whether the scroll function would be useful or not.

It puts the pixels from the bottom of the screen to the top.

I think my current solution is probably the best

Post Reply