-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Waveshare 12in48: fix nim definitions #71
Conversation
Okay, so I tried installing Now I got up to this: 2024-04-01 15:27:35 EPD_12in48b.c: In function ‘EPD_12in48B_Init’:
2024-04-01 15:27:35 EPD_12in48b.c:66:23: error: ‘EPD_M1_CS_PIN’ undeclared (first use in this function); did you mean ‘EPD_CS_PIN’?
2024-04-01 15:27:35 66 | DEV_Digital_Write(EPD_M1_CS_PIN, 1);
2024-04-01 15:27:35 | ^~~~~~~~~~~~~
2024-04-01 15:27:35 | EPD_CS_PIN
2024-04-01 15:27:35 EPD_12in48b.c:66:23: note: each undeclared identifier is reported only once for each function it appears in
2024-04-01 15:27:35 EPD_12in48b.c:67:23: error: ‘EPD_S1_CS_PIN’ undeclared (first use in this function); did you mean ‘EPD_CS_PIN’?
2024-04-01 15:27:35 67 | DEV_Digital_Write(EPD_S1_CS_PIN, 1);
2024-04-01 15:27:35 | ^~~~~~~~~~~~~
2024-04-01 15:27:35 | EPD_CS_PIN
2024-04-01 15:27:35 EPD_12in48b.c:68:23: error: ‘EPD_M2_CS_PIN’ undeclared (first use in this function); did you mean ‘EPD_CS_PIN’?
2024-04-01 15:27:35 68 | DEV_Digital_Write(EPD_M2_CS_PIN, 1);
2024-04-01 15:27:35 | ^~~~~~~~~~~~~
2024-04-01 15:27:35 | EPD_CS_PIN
2024-04-01 15:27:35 compilation terminated due to -fmax-errors=3.
2024-04-01 15:27:35 cp: cannot stat 'EPD_12in48b.o': No such file or directory
2024-04-01 15:27:35 /usr/bin/ld: cannot find EPD_12in48b.o: No such file or directory
2024-04-01 15:27:35 collect2: error: ld returned 1 exit status
2024-04-01 15:27:35 make: *** [Makefile:15: frameos] Error 1
2024-04-01 15:27:35 Command exited with status 2 This seems to be related to the fact that this screen is divided into 4 sections: M1, M2, S1, S2. |
Further progress… Added definitions for Now stuck on: /tmp/tmp_x0qr9zf/frameos/src/drivers/waveshare/driver.nim(10, 32) Error: undeclared field: 'Unknown'
2024-04-01 16:04:32 �[1m/tmp/nimble_34/githubcom_xmonadernimassets_0.2.4_d06724dd7b80fb470542ab932f3a94af78fe2eb1/src/nimassets.nim(3, 8) �[0m�[33mWarning: �[0muse the nimble packages `malebolgia`, `taskpools` or `weave` instead; threadpool is deprecated�[36m [Deprecated]�[0m�[0m
2024-04-01 16:04:32 The command exited with status 1
2024-04-01 16:04:32 Error in src/drivers/waveshare/driver.nim:10:32
2024-04-01 16:04:32 Line 10: let color_option* = ColorOption.Unknown
2024-04-01 16:04:32 ........................................^
2024-04-01 16:04:32 Failed to generate frameos sources I updated the color definition in "EPD_12in48": "Black",
"EPD_12in48b": "BlackWhiteRed", But still getting |
@mariusandra Currently, my biggest challenge is figuring out what kinda regex/string-replacement/template magic is happening that determines this. I've tried looking through the python code, but gotta admit it is hella obfuscated. |
Hey, regarding the Regarding the variants, in order to avoid manually instrumenting each frame, I built a system that reads the The Will merging with |
Will give that a try now. |
I tried to get this working and got so far and now hit a wall. Running the frame controller locally in docker worked fine, and there were a few things that were easy to fix that I'd missed. But now I'm stuck at this: ``` /tmp/tmp7vmbxgrv/frameos/src/drivers/waveshare/driver.nim(10, 32) Error: undeclared field: 'Unknown' 2024-03-25 20:27:26 The command exited with status 1 2024-03-25 20:27:26 Error in src/drivers/waveshare/driver.nim:10:32 2024-03-25 20:27:26 Line 10: let color_option* = ColorOption.Unknown ``` `waveshare.py` has the following addition: ```python "EPD_12in48b": "Black", ``` I then tried following the logic flow through, and tried several variations of `Black`, `BlackWhiteRed`, `BlackWhiteYellowRed` but no dice. Any hints as to where to go from here? I also couldn't figure out how to get print statements to appear in the controller log panel. What's needed to get that happening? Are there any hints on how to debug this kind of issue?
Reverted to using dumb constants.
… the function signature
5a8a60a
to
52e0274
Compare
Hmm… getting the same thing: 2024-04-02 09:02:42 Hint: used config file '/tmp/tmpqaqqcapk/frameos/config.nims' [Conf]
2024-04-02 09:02:43 .........................................................................................................................................................................................................................................................................
2024-04-02 09:02:43 /tmp/tmpqaqqcapk/frameos/src/drivers/waveshare/driver.nim(10, 32) Error: undeclared field: 'Unknown' Just to be clear on the "EPD_12in48": "Black",
"EPD_12in48b": "BlackWhiteRed", and { value: 'waveshare.EPD_12in48', label: 'Waveshare 12.48" 1304x984 Black/White' },
{ value: 'waveshare.EPD_12in48b', label: 'Waveshare 12.48" (B) 1304x984 Black/White/Red' }, Correct? There doesn't seem to be a |
Ah, found |
Came to my senses and just ran it in a docker terminal. The output says: {"value": "waveshare.EPD_12in48", "label": "Waveshare 12.48\" 1304x984 Black/White/Red"},
{"value": "waveshare.EPD_12in48b", "label": "Waveshare 12.48\" (B) 1304x984 Unknown"}, |
I gave it a quick attempt, and got past the errors when I set both colors to I got it compiling with just changing Edit: oops, my bad, it's |
Okay, there were a number of other missing items, once I'd cleaned up the device & driver definitions: mainly to do with the screen being divided into M1, M2, S1, S2 and a bunch of extra pins. So, it's fully deploying to the Pi now, without any errors, and the preview in the render panel on the the Frame Controller webpage looks like a nice black/red 2 color dithered picture with the message and a clock. However… the ePaper display itself hasn't changed. I noticed a whole stack of differences between the Their There is also a |
Oh wow, that sounds more involved. This then also answers the question of why the 12.48" code isn't included in the main waveshare e-Paper repository. Since this seems like a relatively one-off library, it might be worth just inlining whatever is different from For further debugging, I'd try to run the 12.48" C examples directly, and see if they update the display. Then work my way backwards to see what's different. In any case, good luck! I'm off for the night now. |
So, I've tried that but I'm seeing nothing in the FrameController terminal. Any idea where the log files for the |
I got logging coming back from the frame:
So, it's fully deployed now, but still nothing on the ePaper display. Will go over the I think it'll just be simpler to use the I've already run the C and Python examples and they worked fine. I'm assuming there's nothing specific you've added to the Thanks for your help so far! It's pretty exciting to get to this stage! |
Okay, so the problem I have now is that some of the fundamental calls in void DEV_SPI_WriteByte(uint8_t Value)
{
lgSpiWrite(SPI_Handle, (char *)&Value, 1);
} and the older one has this: void DEV_SPI_WriteByte(UBYTE value)
{
char i;
DEV_Delay_us(5);
switch (software_spi.Mode)
{
case Mode0: /* Clock Polarity is 0 and Clock Phase is 0 */
DEV_Digital_Write(software_spi.SCLK_PIN, 0);
for (i = 0; i < 8; i++)
{
DEV_Digital_Write(software_spi.SCLK_PIN, 0);
DEV_Delay_us(10);
if (value & 0x80)
{
DEV_Digital_Write(software_spi.MOSI_PIN, 1);
}
else
{
DEV_Digital_Write(software_spi.MOSI_PIN, 0);
}
value = value << 1;
DEV_Delay_us(10);
DEV_Digital_Write(software_spi.SCLK_PIN, 1);
DEV_Delay_us(10);
}
break;
case Mode1: /* Clock Polarity is 0 and Clock Phase is 1 */
DEV_Digital_Write(software_spi.SCLK_PIN, 0);
for (i = 0; i < 8; i++)
{
DEV_Digital_Write(software_spi.SCLK_PIN, 1);
if ((value << i) & 0x80)
{
DEV_Digital_Write(software_spi.MOSI_PIN, 1);
}
else
{
DEV_Digital_Write(software_spi.MOSI_PIN, 0);
}
DEV_Delay_us(5);
DEV_Digital_Write(software_spi.SCLK_PIN, 0);
DEV_Delay_us(5);
}
DEV_Digital_Write(software_spi.SCLK_PIN, 0);
break;
case Mode2: /* Clock Polarity is 1 and Clock Phase is 0 */
DEV_Digital_Write(software_spi.SCLK_PIN, 1);
for (i = 0; i < 8; i++)
{
DEV_Digital_Write(software_spi.SCLK_PIN, 1);
if ((value << i) & 0x80)
{
DEV_Digital_Write(software_spi.MOSI_PIN, 1);
}
else
{
DEV_Digital_Write(software_spi.MOSI_PIN, 0);
}
DEV_Delay_us(5);
DEV_Digital_Write(software_spi.SCLK_PIN, 0);
DEV_Delay_us(5);
}
DEV_Digital_Write(software_spi.SCLK_PIN, 1);
break;
case Mode3: /* Clock Polarity is 1 and Clock Phase is 1 */
DEV_Digital_Write(software_spi.SCLK_PIN, 1);
for (i = 0; i < 8; i++)
{
DEV_Digital_Write(software_spi.SCLK_PIN, 0);
if ((value << i) & 0x80)
{
DEV_Digital_Write(software_spi.MOSI_PIN, 1);
}
else
{
DEV_Digital_Write(software_spi.MOSI_PIN, 0);
}
DEV_Delay_us(5);
DEV_Digital_Write(software_spi.SCLK_PIN, 1);
DEV_Delay_us(5);
}
DEV_Digital_Write(software_spi.SCLK_PIN, 1);
break;
default:
break;
}
} as well as that, there is an entirely different way to initialise the SPI, in the software_spi.SCLK_PIN = EPD_SCK_PIN;
software_spi.MOSI_PIN = EPD_MOSI_PIN;
software_spi.Mode = Mode0;
software_spi.Type = Master;
software_spi.Clock = 10; So, at first I tried making a Kinda stuck here. My knee-jerk reaction would be to duplicate the whole The problem's exacerbated by the turnaround time… building the docker image takes a good minute or more, and then another couple of minutes to "Save and Re-Deploy". I tried cutting down the docker build time but couldn't figure out how to cache the |
Thanks for all the work with this so far! It's pretty hard for me to provide better guidance since I don't have the display myself, and I'm currently on holiday for another week or so. I did however just order that display for myself, and will let you know when it arrives and when I get it working. Usually it takes a bit less than a week for shipments to arrive from Waveshare. |
It was choking on missing definitions:
This was fixed by changing the
nim
definitions to:I also added the missing
EPD_12in48.nim
which is the other version withoutRed
.Now it progresses successfully to this point:
then fails: