 All right, happy Friday Good evening to everyone evening in in my part of the world in my time zone Hope everybody is having a nice Friday Let's see here a couple more things I can shuffle around and then we'll Do the old introduction and get this show on the road It looks like the stream is live everywhere. We hit live on YouTube. I've got sound going to OBS. We're green there I think we're all set How's going be autograph happy and hello happy Friday and hello Let me shuffle a few more of these around just so I can see the chats here and then The OBS somewhere I can keep an eye In case we drop the stream out or anything like that. Let's do that one there and we'll layer up those like that All right, so hello to everyone. My name is Tim. I go by foamy guy on github and discord This is the deep dive live stream program This is a weekly live stream that occurs here on YouTube and twitch as well as some other places streaming live All of the the Adafruit pages. There's a couple of different places where this is coming from But twitch and YouTube I would say are probably the primary two so Those are the the the ones where I think the majority of folks watch so This is a weekly live stream program where we are Diving deep into the nitty-gritty of the circuit python world. Sometimes we are working on the circuit python Core, which is the actual C code that is the circuit python program that that makes it able to Parse and execute python code. Sometimes we're working in that layer Sometimes we're working on libraries. Sometimes we're working on projects. Sometimes we're working on infrastructure that is Surrounding, you know, the rest of the project. So it just depends Week to week we have different stuff going on In particular today, we will be diving back into the core which is kind of getting back to the roots So to speak of the deep dive program. This program was initially started by Scott the lead developer of circuit python He has he stopped doing the live stream when he took some time away some some parental leave to go and spend time You know raising and looking after his child He's still not quite back to Streaming yet. I think he is back to working on circuit python So he's around now in the weekly meetings and he's around on discord and things like that But he's not quite ready To be doing the streams and stuff. So I'm still here doing the deep dive program We are getting back into the core today, which if you ever go back and watch some of the older vods Some of the episodes that Scott has done. It definitely tends to skew a bit more towards inside the core When he is doing it I should take a quick step back though Just for anybody that might be new if if everything that I have said thus far sounds like gibberish to you if you have no idea What I'm talking about. Let's just level set that for the folks that might be new Circuit python is what we're working on. This is an implementation of the python language Which is designed to run on tiny computers called microcontrollers. There's a bunch of pictures of them over here on the downloads page Over on this tab. There's a camera with one of these microcontrollers Basically, these are little computers inside this device here This little PCB device has a computer in it that computer is running circuit python That's allowing us to write python code save it on that device just like a USB thumb drive You know essentially shows up like a thumb drive on your computer open up the python code file in there save it And then it will automatically You know reread and execute that python code And so the the microcontrollers the computers themselves tend to come in all different shapes and sizes as you can see With a quick scroll through this page Many of them have what are called like IO pins which allow you to connect with other Hardware devices so, you know sensors for detecting things like temperature or humidity or acceleration Or distance or pretty much anything you could imagine You know sensors buttons beepers buzzers lights sounds You know any number of Electronical doodads you can hook up to these microcontrollers using those IO pins and then write some python code to interact with that stuff So that's kind of like the 50,000 foot view of what we're working on if you Do happen to be watching this for the first time and you have Questions YouTube chat fell off. Let me fix that if you have questions or anything feel free to Drop those into one of the chats, which I will try to fix here. That is a bit odd. Is it just Interesting Anzo, huh? Is everything else is still live? I'm live here This is live here Just the YouTube chat, huh on the right scene. That is so weird. It was just there. All right. Let's see YouTube chat Device not connected. There we go. Thank you for the heads up on that Okay, if you do have questions about any of this stuff feel free to throw questions comments anything like that into the chats You can join us over on the discord a da fr u. It slash discord That's the chat that's right below me and then the youtube chat is also on the screen down there as well Just on the the chat for this live stream So head over there if you'd like to ask questions or interact or anything like that Um, let me catch up speaking of the chat. Let me catch up. How's it going to Keith the EE? Happy Friday I hope you're doing well. Also Almost said. Hope you're doing well as well, but we don't want to do that. I guess See grover Nice to see you as well. Seattle Seattle shameless dude man bro complimentary. Nice. Thanks for tuning in. How's it going to Jose david Mark gambler I seem to be alive. Thank you. Um, I think that's a good thing most for the most part And then live here in maguire says so it maybe it hitched or something. I'm not sure Sometimes the stream does does get a bit of a hitch going on and it's giddy up so to speak So if if anything does like happen like that just Hopefully just give it a minute. Maybe try refreshing the page. I should Ideally come back. Um, you know before too long if anything like that does happen Uh, and then what was it was there any complimentary twos today? Uh It may be Maybe I did watch the video who was it near doc. Somebody linked me to a nice video Explaining twos compliment and how it's used to store negative numbers Which did fill in a lot of the puzzle to why we were getting some super weird behavior the last time we worked on this stuff Um Yeah, I don't know if we'll do exactly stuff using utilizing it today, but yeah, that was a nice that was a nice resource to It kind of just pull back the curtain a bit to um To help me understand why we were getting some stuff that seemed kind of contradictory as far as like numbers being both big and small and stuff so um That's kind of the high level intro more specifically today I am going to be getting into the core and I'm working on argument validation Specifically, I'm starting out inside display. Oh display ios one of the places Where I tend to spend a fair amount of my time. I'm kind of just naturally drawn to it because it It just feels very similar to my background, which is um, kind of primarily or largely in mobile development was a lot of my Background these days. I do a lot more work with web web applications and stuff still do some android mobile app work, but More so into the web world these days, but uh display. I always felt kind of like writing a mobile application to me So it's Was a thing that I naturally gravitated towards so Work on display io libraries. I've been Slowly but surely chipping away at understanding the the display o core and working on stuff like this is helping me do that So in particular what we're doing is uh on these functions inside the core Um, they're going to be accepting some kind of arguments and we're just adding validation to those arguments to make sure that they're Um, you know reasonable. They're within a reasonable range. They're, you know, positive if they should be positive, you know Not zero if they shouldn't be zero just trying to weed out, you know values that Don't really make sense or that are invalid. So And importantly trying to have them raise a nice easy to understand exception that tells the user You know exactly what went wrong rather than like, you know hard crash or a hard fault or something like that or Raising an error that's uh unrelated or something like that I've been spending too much time trying to figure out how display o can be sped up lately Have to re-concentrate to get the pr to get the gift pr out of draft I got you. Yeah, I'm excited to try out the gift pr Um, I don't know if I will do it uh this evening, but I'm thinking probably tomorrow on my morning stream that was my my tentative plan was to Check that out and try to play around with the current iteration of it So yeah for folks that don't know mark uh in the chat here mark gambler is working on Uh gift support inside circuit python allowing us to play animated gifts Display them on the screen with display. Oh Um, so I'm gonna take a look back at the pull request here just because I don't remember what the last Bit of feedback was I think we got some from jeff and I I want to say I got through those But I do need to kind of just level set back to where Where I was at here So we did already we have this range and I think I did end up going back and Adding some stuff inside of blitz So it's int 16 I want to say we did take care of this. So this was blitz and this was the x y as well as I think x1 y1 x2 y2 Um Yeah, yeah, yeah, okay. So here it used to just have int 16 And and then it pulled it right out of there Now it's art. Uh, it's validate arg validate range Zero is the lowest With minus one is the highest height minus one I think we're actually good there. I don't think we necessarily need to change those like this was proposing initially um, but we should have solved the same problem of Big numbers will get filtered out in this case. It was like, you know max 16 bit integer or whatever we couldn't go higher than that um The actual validation we put in though is to the width as well So if your bitmap is only 200 pixels wide, it will just start giving you an exception at 201 pixels or Really at at index 200 of x is where you would first get the exception raised Part check there's already range. And so there was some range checking So part of our problem here though is this is referencing some lines of code which are Now different I'm going to try to pull up The current main because I've edited my branch at this point. So it's not quite Not quite the exact same anymore I want to say we took care of this though with our existing essentially with this This one and this one And this one and this one for the twos the x2 and the y2. Yeah It's gonna take a quick peek at what the old Thing was that was mentioned here is it 242 or it was before 246 is this one. Okay, and this was Giving us the same basic check But importantly this was happening after it had already been converted here So now that we've combined it we're essentially doing this check in those arg validate calls now these ones here Which means we can get rid of the logic Afterwards, which I think I've already done. Yeah Okay So this one Would this be validate in range with the low zero the high of get with minus one This might be the same thing Actually Well, no, this is checking here Pixel coordinates out of bounds which coordinates out of bounds. So this is in what now this is in The subscript Okay. Yeah, I mean we are doing a minimum check right now But we could do the range and then put the maximum as well, which would be The width We might be able to just say self arrow width though instead of calling this right Maybe I think we could do it that way. So I'll comment this out for now Wait Oh, that's unfortunate. So if this was validate int range Right, let's see one right now Validate int range. Yeah Oh, this is somewhere else actually I wonder if we should do a range here as well These are the actual ones. We were just looking at realistically. We probably want to double check everywhere. That's using min Uh And just double check and make sure we just see if we would want a maximum. I suspect a fair amount of them We probably will want maximums well The range and then here we're gonna say So items this is when This is in the subscript when you pass it two things like You know two comma one And then these are the two things you're passing it and so the maximum is gonna be Put the comma in the wrong place Yeah, I didn't add a comma. So we'll need a comma here and we might be able to do something like that It will need to be minus one though And then as long as that works it negates the need for this if statement here So we need to make a build uh, so first build of the day. So I need to go export Export IDF and that is the device we have so we can make that It's like it failed. We're gonna do a clean creation type analog in segmentation fault Something must be pointed back to the code I touched Hopefully I don't know. None of it does look like it though, huh? internal compiler error Touch sensor by set but not used This p system panic extends I don't know what any I don't know what any of this stuff is for um Let's try a non ESP build and see if it's any different while that's going I'll just Check the code. Did I mess up parentheses or I look like it. Yeah, and this gave us a good build actually so It's like Could it could I need to run install again? I mean this part says But it's okay Maybe this has something to do with it No tags. Okay. Maybe this was less successful than I thought No tags can describe I always or create some tags Try install first Same problem Try the build again, but I don't necessarily think it will succeed Maybe different. Okay. Yeah Don't know what that was about, but made it there in the end Um, I guess the install I suppose is the thing line 184 should be checking height not width are correct. Yeah. Thank you Here we go bootloader mode It's not too much to see here, but might as well pull it up So you can see what there is at least but Do that to the device And then our current test program Oops is uh calling blitz That was the last thing I worked on But we need to use the new thing that we've done which is the subscript And specifically we just want to validate that when we subscript With the two With the two like this with the two numbers inside the square brackets That The upper and lower bounds are both working So that we this should succeed Technically this would put a little pixel inside of here to a certain color I don't know forget which color is which at this point, but Yeah, I can actually see it. See it doesn't quite come through Camera all the way you can maybe kind of see it there a little bit There's actually two of them because there's another one from somewhere else, but Is there And so if we did negative one this should raise the exception that comes from our new code now Which should tell us like a value error x must be zero to 39 perfect and that should be from line 54 is that That accurate i'm just going to rerun it so I can see the line of code with it But With is yeah with is important is yeah, and that's honestly A huge hug report to see grubber because that's the perfect like That's the perfect storm of a bug right when that's When that's different because like lots of bitmaps are going to be equal, you know It's it's 100 by 100 or whatever right? They're equal and therefore it accidentally works Uh, but then when you do when you do find the one that is oblong And that bug by cho it's like I suspect it would have been quite perplexing so Thank you, uh Thank you and good. I for sure. So we got our x here must be zero to 39 which is good So if we put that to there we go negative there it should be the exact same thing But it should tell us now y instead of x perfect and So let's do the high side as well. So 39. So if we say 40 Should give us the same error. Let's look at the Let's look at this one There probably should be some kind of bounds on that as well, which I think there was Wait, what what happened to the formatting? I have wrecked the formatting somehow Or like commits though I want to see commits. I want to see like actual Changes local changes So I I must have I must have done control alt l which I'm in the habit of doing which and pycharm will format the code but in this case The formatting is awful. We don't want it. I need to undo it ideally without just I don't know when I did it So I don't just want to like press undo a million times And I'm not really seeing a great other option unfortunately I don't know why I show history. This is the page I want, but it's not This is not what it did before Not what it looked like Because these are only commits But I'm trying to find like Changes that haven't been committed This and I swear there's supposed I swear there's like Is it called in pycharm? See, but this one's not good, I guess Have history I done Local history show history You see this is what I'm after show history. This is like these are not commits. These are just like The file was changed at this time and then here's the change that occurred We click into different ones. They'll be Different things Local history. Why is that? local Local history show history History is empty Like these are still wrecked. Oh, that's the one Is it? No, that's yeah. Yeah. Yeah. Yeah. Yeah. We want to See if I undo this though, it's going to undo our other change as well I mean, I guess we have to at this point Put this Actually, maybe it kept those two. I don't know We're inside subscript You have to get out of the habit of control alt L. It doesn't Uh, clion, which is what we're in here doesn't Yeah, the formatting doesn't work, right? I don't know why yeah, it's probably needs to be configured somehow I'm sure there is a way that it could work, but The way it is right now, it doesn't work and now this stuff is gone again I'm not to mess that up this time. Hopefully bootloader I just want to install this version and make sure that it's actually back to the same State that we were in hopefully No, that's not right. We need the minus ones Okay, don't press control alt L. I don't know. I do that a lot I like instinctually I do that a lot in pie chair I'm like pretty much every time I type a new chunk of code I do control alt L because it pretty formats it I'll have to figure out what's up with my settings in here why it's like Got a wonky, you know, maybe I could have ran pre-commit pre-commit might have fixed it for me because it's got Not black, but whatever the version of black is for c code Maybe it's black. I guess I never really thought about it Is it actually black or is there a different project? There we go That one doesn't crash and it filled in that last pixel down there Is that actually 40 by 40? Was it bit amount 40 by 40? So we're just zoomed in so far kind of So what about our third number there the one that gets passed in on the right side of the equal sign in our case that would be Value this is where it's validating that it's Small enough But I does it not validate negative Pixel value requires too many bits 54. It does validate Well It's raising the exception So maybe it should just be um, maybe we should do our arg validate range It bits per value So is that what's going to return our power of two like our maximum number? No, the I still don't know is it I still don't have it memorized mp plat print string With a new line now i'm going to substitute a thing in so we're going to go sent d comma So we'll hopefully print this out for us. All right, let's go to loader Let's go an axle magnus Nice to see you this evening. Hope you're having a nice day. Although probably not evening where you're at. So about that Hope you're having a nice day nonetheless It's per value two to print it out a bunch of these and so But that's not the actual maximum What that's saying is the maximum is The biggest number that you can store with two bits Which is actually three Which in our case is what the maximum is If we used like five and five Then instead of printing two it will print, uh, three because you can store The decimal value five in three binary bits Still two maybe I was wrong Oh It is four The twos I think the twos are probably from other bitmap Because we still have other bitmap going on here as well When I comment that stuff out for now There we go. Okay. Yeah bits per value four. That's But that's still not quite what I was expecting Shouldn't we have three? um I don't know unfortunately I've got to step away for just a minute run to the restroom I'll be right back just gonna try and hold it, but I'm definitely not gonna make it so BRB Okay, sorry about that before I started but I also Got a cup of coffee before I started fun to watch behind the scenes program and gotta go teach. Oh nice Yeah, have a have a good evening. I wish you the best in maguire. Thanks for tuning in See you around next time if you want to join us back again um So four I was This four makes sense I mean with three bits because with three bits so it'd be ones twos Two bits you can store three because one one is three With three bits you could store Four go one zero zero And so then one zero one would be five There's only three bits It's actually odd. Yeah, it was Must not understand common how get bits per value That you can find where this is to find bitmap paired bindings bitmap paired module bitmap 91 Just returns bits per value So there it looks like it just gets passed in This is from buffer though So but then it would be five though I mean could this change it? I guess maybe Otherwise it puts it on to self here bits per value Is greater than eight And it's not 16 and it's not 32. You know what this represents bits per value Is that right? I think so All right, let's print it inside of here as well when we create it So I mean I as far as I can tell looking at the code This is just the number we pass in in the argument. I mean in the uh constructor, which is To be five In my mind. I had it differently in my mind. I was thinking like which I think this is the logic for what I was thinking It's finding the smallest Power of two. It's finding the smallest number of bits of binary that it could store the number inside of I was thinking it was doing but that would be three bits for five and we didn't get I didn't get that Not copied yet It's bits per pixel. So rgb 565 is 16 And rgb 888 is 24 For argument validation of what bitmap validations. I thought bitmaps were taking care of validating bits. Maybe not Not sure what you mean Validating that uh, excuse me validating bits mostly though the thing that we're doing the validation on is arguments for Functions in the core in this case. It's a constructor for bitmap But we're also working on the subscript function, which in python land you don't use it You know, you don't write a function to do it. You do the the square brackets and stuff, but On the c side it's still a function And so that's the These kinds of things anything that you pass into there anything that you pass into the constructor here Um, those are the things that we are working on validating Definitely did give four so weird. I don't Look at how it's any different you could stride change this. I don't know what that means to stride is that This first see if it makes any difference This more blanket. Uh, it's not. Nope. This is inside the core Yeah, so we're inside the sea lion here and we're making builds of the core And then pushing it to the uh feather tft that i've got set up here In a second time, but yeah it is still four But it's not changing I guess that's because shared bindings Changes it shared bindings make new this one takes value count Here is the logic. I was thinking Think That's figuring out how many bits Looks like it has a minimum And then it calls construct and it calls it with bits here Okay, that's how we're changing so this one Value count that's the number we are passing in that is the five In our case value count And then what this here this is Causing it to be converted to four Some way that is something to do with the number of bits it takes but it must be Not just straight up the number of bits because it should be able to store The value of five in three bits, but we're ending up with four Any which way though this is this does account for the difference, which was the main thing I was perplexed about So unfortunately we uh, we we don't store We don't store value count Um value count comes in here We probably do a range thing on it though. I guess uh, can we do a range? We can't yeah No, never mind. We can't really do a range because Is there a maximum of 255? Maybe that could be the range We have value count it gets put into bits and then bits is what gets passed into bitmap construct Bitmap construct has bits here gets passed into the from buffer one which has bits here And they get stored as bits per value So we can only check it against That bits per value. We can't check it against value count value count is gone. We no longer know We no longer have a variable that's storing value count anymore Here's our subscript So I don't know I don't quite I mean part of this is just me not understanding the bitmap operations or bitmap excuse me the binary operations what is What does this actually do It I think it's bit shift right, but I don't know what does that mean Left shift right shift Is there uh, is there a way to print it like this? I can't really I Really visualize what's doing pick value shift it right by The bits per value and then check the result if it's not equal to zero Print f will do hex. Uh, we're still back here. We're in python land though Rather than mp print Um, and I could do hex I guess but it is there a binary one Here is okay Okay, so that just straight up moved the Moved to the one Oh Okay, the leading zeros Are nothing those those just go away. So that moved the one to the right by one Okay This one moved both of them to the right so it's So everybody moves over to their neighbor Which I can get now, but I don't follow the logic here. How does everybody moves over to their neighbor get changed into Your your number was too big Right like technically this is saying your number was too big, but And also we were just going by one every time I guess right and we have a four here So I just gave us zero So that moved it over by four So if they passed in Five And it got a bit shifted by four That is zero they passed in Six at zero if they passed in seven at zero Passed in eight. It's also still zero Somewhere 16 it changes One So effectively Effectively is that true? So effectively this is the same condition basically as that Because four squared is 16 Be greater than equals I guess but 16 is uh x 1 0 0 if you shift four you're left with I got you. Okay. That does make sense. Yeah The last one last one shifted there. So effectively though, this is essentially the same condition If I'm understanding right Yeah, yeah, I knew what you had or I knew what you meant rather with the zero B I think the idea is if each pixel is x bits Shift them all out Anything is left than the original number Needed more than x bits Store is too big your division by 16 By 16 I don't follow the division The shifting is really fast. So this is an optimizationization Handle it quickly Okay, maybe we don't want to mess with this one. I guess Well, let's not worry about I I guess let's not worry about the high side. Let's try to do the low side The thing is that we already get we already get the error And then technically our our error message is backwards here Let's do the minimum check So if you go negative This will tell you that it's too low Instead of telling you too many bits, which is technically kind of backwards at that point too few arguments Oh, I did range, but I need min I mean, we could try range, but I don't know how to do the top I don't know how to do the top of the range probably whatever I'll do is going to be slower than this or Possibly not be correct. Anyway Use that for Your b r r g g b b You want to get the r r red component Okay, that's something you can use the bit shifting for is to basically filter out the uh to one specific color channel Double tap speed was not quite right. So I didn't get to boot loader Okay, we're getting into something it's Just boot loader copy the uh, yeah, I was gonna say I probably should have slowed down just a tad but I was going johnny There we go Value must be greater than zero And so like I mean theoretically we have told it You know five is the number of colors So like theoretically values zero through four should be what are valid here But I think due to the nature of the way it's doing this binary thing instead of Just checking greater than It's actually giving us This issue where technically like zero through four are the only numbers that actually do anything but technically this is going to let me do five six and seven Maybe even eight maybe even uh up to like 15 Does eight work it does so up uh 15 works, but then 16 I think will be the next one that fails so it's it's It's technically making the range more lenient than It is in reality in reality zero through four Are the valid color indexes? In the palette that we have selected But that I I don't think I'm gonna change because that would have to basically I mean kind of two things for one thing Like I think we would want to use greater than rather than shifting although maybe shifting can still work But the real crux of it is that we would need to store That value which we just don't do today We convert it to the bits and then we pass the bits into The the number of bits we pass that into shared module From there the number of bits gets stored Not the actual original value count Um So we're not actually storing the number five instead. We're storing the number four And later on we're calculating how many numbers fit inside four digits of binary Um in our case five is allowed to fit there All the way up to 15 is allowed to fit there But the low side we got fixed up this I'm happy with Must be greater than zero and and I feel like that's a better error message now because this Before it said that your value had too many bits which suggests that it's too big in this case It's actually too small. Um, so greater than zero. I think is nice there Let's clean up our prints Whoops. Whoa. Whoa. Whoa. Whoa. There we go. Uh Should we commit here? So I think we did do that right that was the X and Y inside the subscript Does now do use range This one is 144 inside shared bindings. This doesn't negative indexing Okay, so that one's not one to do right now But basically that's saying Where's our value now? So the numbers are now gone. Well not gone, but just in a different place Inside substitutes. This is I I is in here Right. So right now we have we're validating that it's greater than zero Uh, which is good because it filters out values that are less than zero Are technically not valid. However in python typically when you have a list like thing Sorry about that might have been loud. I apologize When you have a list like thing a thing that behaves like a list If you do a negative index like that, usually it will get it from the end of the list Um, and so what Jeff is saying like in the future state here instead of just throwing out negative values as invalid we could Do that like expected python behavior of going from the end rather than the beginning Um, and then we would need validation to make sure that it's uh, basically less than the absolute value of length Or that the absolute value of it is less than length essentially Which would be nice, but I do think I agree there is a separate issue. It's not necessarily about validation It's more so about adding functionality Be nice if these two checks could be consolidated Up or bound would be something like this is value which we may have done 289. Is this what we did? No, this isn't fill Oh, oh no, this is at a different place. Where is this? Ah, see it's tough. We can't actually see Once you start modifying code, it's like it's difficult to tell This is inside of fill. Yeah Okay. Yeah. Yeah. This is what we just look is it well it Okay, it's not like literally exactly what we just looked at but it is the same check It is the same check. Maybe we could try to consolidate this one I do think it's still gonna always have that problem. Like I was just talking about where it's gonna allow up to 15 In like my example code here where I had set it to five Because it's based on that number of bits per value Will always go bigger, but we could maybe instead of min we could say range And then the range would be here The maximum would be this one u Left shift value minus one, uh, but it wouldn't be value. It would be um Bits per value. I don't know the order of operations with the bit shifting. So I'm gonna go parentheses minus one Don't use control alt l You know the other thing isn't this a different isn't this worded slightly differently? Pixel value requires too many bits However, I will say I guess if we do consolidate the one inside fill We should probably do the same thing with this because it's like literally the same code essentially A different function, but serving the same purpose. Maybe I mean, maybe we should have a I mean the arc validate basically is that function. I was gonna say maybe it should refactor to a function, but Comment that and then this is in fill We'll have to modify the code to use fill So Okay, so first we do still have We do still have this Put that to something valid And then bitmap fill So negative one Should be an exception and it should be the same as it was before technically because we already were checking the min Now we're also checking the max and it does tell us zero to 15 And this is now where like 15 it won't raise an exception, but it also won't like work Which in this case means it won't be visible. It's not a color that it has A visible color basically it's not an index that has visible color 16 will be greater than That should Give us the exception zero to 15. Okay, so that's good And then I do think we may as well do the same consolidation elsewhere, right the other place where we have this Let's get rid of that Let's copy this And then let's go find the other place which Honestly, let's search for um bits per pixel per value Let's get rid of this that Don't use control alt L We should get the same exception still as before We're gonna go modify our code though to not be doing fill anymore and instead go back to doing this one So negative should kick it back out at us for between zero to 15 Okay, and then so 15 technically works it doesn't raise the exception is what we expect. However, it's not a color either But that's all right. We already know that and then 16 though that should be the The the lowest one that fails. So this should give us Perfect value must be between zero. Okay, first palette too large An interesting check Type blit. I guess that does make sense for blit, right? If you're gonna copy from one to the other. Where's our subscript? Oh I don't think I changed anything functional I'm gonna double check to make sure Build and then if this build works then we'll run pre-commit And we'll push Make a new commit and push Date the pr and I Think honestly, we're I believe we are good on bitmap after this. I don't know of anything else We'll give it maybe another once over through shared bindings just look and see if there's any parts of the api that we haven't hit yet, but I feel like we got bitmap pretty pretty good So then we'll if that's the case, then I'll look into palette and maybe tile grid and see if there are similar Similar validation Opportunities there if we still need that stuff over there as well Um, so so far that's looking good Let's give it a good value. Let's just make sure it does Go through and then give it an actual good value that's in the range as well The range of actually visible. Okay, perfect. That one doesn't crash. Just raise this goes on Build our formatting. So just run it again because it automatically fixes it for you Get ready to push I don't want this change. I don't know why it's different, but we don't want it. Oh, we probably don't want that I don't think we It's just like we put a print there before back out Actually need to technically cut the line there Using validate range instead of the if statement afterwards Good thing here. I want to say that was it for this right be nice if these could be consolidated Uh I think we did this one So coordinates out of bounds You don't like or have out of bounds at all Shared bindings bitmap. Yeah, so it's no longer there. So we're doing validate range now on that It's in it's difficult to tell where it's at exactly from this, but So I'd make new I can say to make new Do not though Oh, yeah, there's something missing here Subscript Okay, that was the x and y and subscript They're here and we do now use range on and we no longer have the uh If statement by itself Okay, so that I'm back here after committing though. I don't think we ever did address this one Hey, hey, hey Putty Second we got to get the cat instructor Locked to put some stick so that it's spelling sometimes This I think we did not do this is in make new height width value count height width Value count on my car. Is it? Definitely been that person More than once more than I care to admit but this time it wasn't me I'm gonna hit the old panic button on their, uh Key fob for the car Okay, so basically here we can just hard code Arrange maximum three two seven That did I can do build with that And then we'll test this Sorry Try to get the microphone like right in front of my face here So that it's like got the best pickup for the sound But then I accidentally bonk it when I'm trying to reach up and grab my mouse Imagine that's somewhat loud on your end. So I apologize for the uh Startling or the blown out speakers or anything bad on that That went over And so then we will test this by Making a new bitmap that's bigger than this Realistically we probably run out of ram, you know, if you just did like minus one from here, right at 766 or whatever like Probably not actually enough ram You make one that size but Maybe in one orientation I actually know So let's get our other bitmap Back here and I you know what I'm actually I'm gonna leave that one commented out I'm gonna make myself another new one. I don't already have one but Let's put that and then one see if we have enough for that. I don't actually know It did actually work I wonder if we need to use minus one Or I guess that's already right, isn't it because this would be the power of two right the power of two definitely ends with an eight So we want to go one less than that That's our actual maximum We did have enough seemingly Yeah, I mean it's tens of thousands, but it's Honestly got quite a bit more headroom there, truthfully Uh, love the factory. How's it going? Olaf from the colorado back at you here from the Kansas City Let's see. It would be nice to have a python style indexing Including slicing for bitmaps finding slice objects to be pretty handy for manipulating pilots including using calculations via ULAB micro lab Circle python micro lab creator is thinking about bitmap image creation and effects in ULAB micro lab The future support for slice objects in the core might become a thing. I am definitely down for that I'd be Slicing in the bitmap itself It'd be pretty cool. The part that makes it New territory for me is the way that it accepts the multiples So like Like this bit here where you're kind of giving it a tuple as the The thing there so like if it was just a list for instance, or if it was list like then You know bitmap zero bitmap nine bitmap 39 whatever these all make sense In fact also bitmap, you know negative one negative indexing from the end of the list That's all good with me And then you know things like zero colon four To give you the range between zero and four that's good with me as well I can get and rationalize all of that and I can picture exactly how that would work But then how to do these How do these two rectify to get together is there like Like can this one be a range and this one also be a range or Do the ranges only support the single A single one that would be the question mark for me on the slices for the bitmap is Do we intend to make it somehow work with those multi? I don't even know the name for this but the multi You know multi-argument subscripts. I'll call them for now Slices should be possible. They're in pixel buff Yeah, well, yeah, no, I have no doubt. I mean it could be made possible But I mean in terms of the The api or the functionality like Would there be a way to do a slice with Both x and y or just only Yeah Which and it's I mean effectively it boils down to the same thing right this You know, this is kind of like convenience 39 39 here You can there's a single number that will access this as well. It's like Let's use a smaller one Like zero Let's go zero one so That's zero x One y so that's down one So then this pixel is actually the same as In our case bitmap it's 40 by 40. So it's the same as uh It's the same as this 40 here The first pixel of the second row So these ones are like convenience for Doing the multiplication or the modulus or whatever to get to the size there. So Now technically you could kind of do it the same but if you could do ranges like You could do multi ranges like this that'd be crazy. And if that would give you back like a Bit of rectangular region from so it'd be like from zero to 10 x And then from one to 12 y it would give you the region that It's within that I have no idea if that's I have no idea if that's even possible though. So we did do maximum on that and it is now forced there perhaps bitmap Okay, yeah use the two Use the two square brackets Which yeah, I think interestingly enough. I think that might be I you might be able to do Actually, I don't know now. I'm second guessing myself It might be valid to do this too though. I'm not a hundred percent sure But then that could factor into how the ranges could work too potentially is you'd have the second square bracket See we should pre-commit This time it's just the three changes to range and the maximum of 32 Seven six seven I think we're caught up on all the feedback that we have so far I'm thinking of coming up with a mini roadmap future plan for display. I would be useful Been spending too much time thinking about it lately though Yeah, I'm uh I'm always Always interested in the display. Oh world for sure. So Be interested to see Kind of things are possible. I think Jeff has been kicking around some ideas as well About display efficiency. I think I've heard of mentioned that a couple of times as well um Do you I don't were you? I don't know if you were here the other day Excuse me when we were talking about this mark. Do you happen to have any idea on p.o? Like rasp, excuse me raspberry pi pico with p.o Is it able to drive? Well, well, this is kind of a two-fold question. Is p.o able to drive spy a spy bus and then secondarily if that is Possible Is there any reason to think that that would make display? Oh faster like if we could be communicating To the display via a spy bus That's actually done implemented via p.o Would that speed up the Drawing or is it not work that way or not make sense or something? Um, or do you not know that's fine as well. I definitely don't know the slash tile grid pr had a lot of good ideas What's the look into that one? I don't remember the tile grid one so group doesn't Group pretty much doesn't have Doesn't have anything that takes I mean there's x and y But those are allowed to go negative. They're also allowed to go above the It can drive a spy bus, but not sure if it would speed it up or not. Okay That's maybe one thing to try out. I know like p.o is obviously a you know specific to the raspberry pi port or whatever So it's like it's not going to help across the board, but Um, it might be interesting to give it a try someday. I'd be curious p.o for parallel displays. Yeah, good question as well parallel with the extra so instead of spy the uh You know more lines essentially say eight wires instead of uh four or five or whatever spy is It's it's like a full byte per wires or something. Oh parallel already uses p.o. Interesting. Nice Uh, well, there's some pair you can do parallel on non non rp 2040. I think as well Like I've only done it like once or twice. I think When I see okay specifically on 2040 Is implemented with p.o. So then theoretically like So that's one maybe one test would be Set up a parallel display on an rp 2040 using the p.o. pins and then set up the same one on a On a different port, you know expressive or samd 51 or something See what the difference is. It's not quite apples to apples if it's you know, if it's two different processors obviously, but You go examples Oh a spy there's a spy p.o. Okay The data said parallel will be disabled on most you know, I spy boards That offers no advantages over spy with ESP and higher clock chips What I'll be back in a minute. Okay, sorry about that somebody's at the door Our portal tft is parallel. Yeah, I believe so as well. Yeah, I think so on the pie portal The ili board is parallel hx The tft feather wing is isn't parallel. I think the ili will be the last one though It's disabled for the rest for the new rev of the ili Quick to p.o. Reed seems to be faster than peripheral. They have a transmit only aimed at the st 77 89, which is a display Okay I have yet to really dive into p.o. Yet. I know kind of what it is and I'm aware of like What it kind of does and and stuff at a high level and I know we have a library and some stuff for it But I haven't I haven't dove in just yet to it Myself. Yep. Take it easy. Keith. Have a nice rest of your evening. See you next time That would be interesting though. That'll be that'd be a fun exercise one day to to not only Dive into p.o. Figure out You know personally just get my hands dirty with actually running it and doing stuff with it, but also Maybe try taking a stab at Seeing if there's an easy way to measure the speed Before we go all in on like trying to make it possible all the way it'd be nice if there was like an Arduino program or something that we could Maybe compare against even though knowing again that it's not apples to apples, but Might give us a an inkling one way or another of Gonna help us out. There's always a butt after looking at the trace My salier the majority of the time is still waiting on the cpu not the bus on a basic example ah Okay, so even if the bus was going faster, it's not It's not guaranteed that that's actually going to do us any good. We may not that may not be our bottleneck Rewrite rewrite four wire as p.o. Four wire or something as a test Yeah Yeah, we're even higher level if there was some if there's like like this example that you linked or that you mentioned with the st This one is spy Maybe like use this It's four wire or the uh lcd like this one I don't even know exactly how to run this As c code, but it might be a decent exercise for me You figure out how to get this to compile and run run it on a device and then Just look at what it's drawing look at how fast it can draw and stuff like that knowing that this doesn't have any The overhead of circuit python It's not like a one-to-one Compare but if if this can draw and update the screen significantly faster than circuit python can then it might Might point towards the fact that if we were to implement that in circuit python, it could speed us up some I'm gonna try to write up some display. I have findings on speed and the gif work this weekend or next nice I'll take a look at that once you get it Once you get it out there for sure okay, so X and Y here pretty much don't have Any practical bounds. I don't think Um Because those can go negative In order to indicate that it's like off the left edge of the screen or the top edge And they can go above width and height to indicate that it's off the right or the bottom edge So those basically don't get clamped um scale. I guess you could say I mean theoretically we could do the same like Three two seven six seven We've already got a validate min On one so it can't go below one You could do that if you get index. I'm pretty sure that will raise value errors if the index is at a range index Other get index. So I think that will do the bounds for us there sort I don't even I don't know what sort would do Sort the members of the group based on what though I don't know how it decides which one is greater or less We still very interested in animator gifts Seven ps is already too faster than a full screen Keep it BMP sprite Each solid ish line is the writing of run run row of pixel data out The gap between is all the work preparing the rex next row multiply that by 240 those gaps are just under one millisecond each Okay, so our bus like our actual communication is not the uh slowest thing potentially I will definitely freely admit I don't actually know like Once you get down to that level, I don't really know Which thing is the limiting factor ultimately sounds like maybe cpu in this case I think it's gonna depend on different Potentially at least that could depend on different sized images and things like that as well Actually, no for sure though. I think that's all we can really do in group. I think scale is the only thing that It's only field or value or whatever that's attached to group that That really has a Bounds, I mean, I guess we could do three two. I mean, I guess we could do the same thing with x and y But we didn't do that with um We didn't do that with bitmap. So If we do want to do that, I think we do it across the board essentially But for now, I think I'm just gonna leave it And like essentially when we're representing those pixels if it's a thing that's allowed to go off the edge Then we just leave it with no validation as far as for right now cpu complexity and fpu availability and moral figure in Yeah, same speed on this three Still haven't quite used this three hardly at all. I think I fired it up maybe two or three times, but We'll count So this one it looks like doesn't have any validation. It's not doing uh, it doesn't even look like it's doing negatives. I guess right We got all the way to 46, which is This one with our Bitmap that's too big. We'll just turn that off M4 has floating point. I'm curious to see the speed diff on that I haven't tried profiling yet. Once the gif work is done I try to set up something I had a bunch of the a bunch of mcs At overclocking the display Assuring in dma Never done anything with the overclocking on the displays there personally Yeah, so this one got created with negative one, which I think that shouldn't be allowed, right? It should be The a palette with negative one colors makes those no sense, right? So Let's go I guess I guess it's like, I mean we would put it in here the impi arc validate Do we want to have it all as one big line? I guess I suppose so Do we allow zero? I don't think so, right? I feel like one is the I mean, I guess zero it's like Not technically a problem, but it's not useful, right a palette with zero colors May as well not be a palette. You can't use it for colors. You can't use it for anything really I don't even know if that's right still Why do we not get an error? That's just like this thing is not found. Maybe it's probably in there somewhere I just didn't scroll enough Okay, that's I probably did this wrong. I just did this wrong Maybe it's I guess it hasn't been used yet Oh, no it has Int range int was the I was missing that word int The clock in the CPU would help, but I think there are optimizations You have to be gained cut out a bunch of code as a proof of concept and got the 950 US or so to lay down to oh wow 172 that's a sizeable chunk VI HDMI I got to pick up one of those little HDMI adapter things or these technically DVI, but it's an HDMI plug Bus at each bus right at 33 megahertz is about 170 us DMA you could uh, you could almost have the bus at 100 utilization all rendering one refresh Processing between frames is separate firmware Too fast. I didn't hit it. Okay. We're gonna wait for that to And to a hard lock on the display overclock at exactly 333 microseconds Kind of update no longer allowed you to hit 72 Yeah, code count must be one two euros should be also out of bounds That one's using get index Pretty sure that is actually doing some of the validation for us. So like if this was 10 You went 10 Be sure that fails are ready for us Yeah, index out of range 26 perfect And I assume for negative one although that's a similar to what we were talking about before it'd be nice if that did work Oh, actually it looks like it looks like it did Oh, and maybe does work I wonder what that did. I don't think we can just print this. Can we print this? We can print it, but I don't it's not going to show us the colors. Is it? Don't exactly know why those Are the things that are in there, but No, it doesn't look like it's going all the way up. I'm not sure if that's actually setting the last thing or what I don't know what that's doing To try that some more later and actually print all the values out Yeah, and so that's a beautiful thing about projects for sure get you into all kinds of stuff. You never would have thought We're sure Okay, I think I'm gonna wrap it up for the night I'm back here. I don't necessarily think we will have gotten anything new yet. No We'll run pre-commit and make one more commit here L equals other palette messed up my loop there Oh, you're right. Yep, that makes sense. Thank you for that Fix over there on the python code side okay those are in Hit the rest of palette as well as tile grade later on and then It's basically it for display. Oh, maybe display Usually user code doesn't necessarily initialize the display as much like built-in displays. You don't have to do it for so Doesn't actually get done in user code too much, but there might be some stuff in there. We could validate as well so Look at that stuff later on um I'll be back in the morning tomorrow I am going to try to take a look at the gif pr to test that out tomorrow See if I can get that running on my device try it out Um, so I'll be back here at 10 a.m. Central time for that Um, it'll be over on My own twitch from a guy underscore twitch. You want to follow me over there? You can get notifications double check your settings to make sure everything is enabled and stuff sometimes twitch is not The best about actually giving you the notifications. So just double check you got everything on if that's what you're looking to get um Thanks for hanging out everybody tonight Probably about to I'm probably about tomorrow ping me if you have questions on the pr. It may not be right there Okay. Yep. We'll do if I if I weren't into anything and I'm curious about it. I will hit you up Whoa Okay, um, thank you everybody for watching. Um I will see those of you that want to join me Tomorrow then and then I think I never did actually say it up at the top of the show So let me go ahead and just say thank you to adafruit Um Adafruit the hardware and software company based out of new york. This is their website adafruit.com They are the ones who uh provide the financial backing for circuit python. They're paying the folks who work on the project There's team of folks that work on the project full-time And adafruit pays their salary to do so There's also some folks like me who work on the project part-time adafruit is paying us to work on it part-time So huge thank you to them And then if you want to help support the circuit python project One of the ways you could do that is just by purchasing hardware From them at adafruit.com so you can head over there get yourself some microcontrollers get yourself some toys A little electronic dude ads to hook up to your microcontroller and play with all sorts of stuff there Um, they've got you covered on that. So thanks to anyone who wants to purchase hardware from them Uh, and yeah, that's that's gonna do it for now. I will see you all next time