Wednesday, December 26, 2018

Cables... oh god. So many cables...

Been busy removing old cables and stripping the playfield from "debris" the last few weeks. It was a big but crucial step in order to get the new wiring neat and functioning properly. 
1) Cutting commenced! It's funny how destroying things always goes faster than building them...

2) Patient is on the operating table.
Straight under a florescent light, there's _finally_ a good work space to work on the machine!

3) Remains from the sockets and switches. The cabling all in all filled a big plastic bag... :|



I found out that I had placed all switch diodes wrong, so I actually redid the switches... twice.

Oh the horror when reconnecting a fully rebuilt pinball table and.... nothing. Haha.

But it's done properly this time, and as an added bonus the wiring is identical to commercial machines now. This means that if I forget how it's built in a few years I can always look up the wiring online - or in the manual I've decided to write for the machine. The manual will keep track of all hardware, parts and positions etc, and will have pictures and "maps" to show each position. I have also started gathering manuals for the actual hardware used on the PCB and table/cabinet. Nothing should have to be guessed or "reinvented" during the next repair. :)

4) Yo, Internet. Welcome to my crib...

I've also miscalculated the amount of cabling necessary now that I've gone full matrix on lights and switches and making sure each switch follows the trunk. So basically I'm 90 meters in and only had enough cables for the switches. :'D

But more cables are on the way, so early next year I'll have the lights and other cables in place!

5) The finished (more or less) wiring for switches! Since I've been using different switches of various makers
I've unfortunately not been able to keep a pro-standard everywhere, hence the "floating diodes" in a couple of places.
I also ran out of shrink tube, which will be used everywhere there's a cable "edge" visible.
   



The coding was also revamped slightly to accommodate the changes in the switch matrix, and overall it seems rock solid. Of course, it will be tested and retested during game rules programming, but I haven't been able to "trick" the machine from detecting hits now, something that was possible earlier due to the relatively (very) slow switch detection.

Thursday, November 29, 2018

A Pin Best Servo'd Cold...

Woho, a proper update!

I've rewritten (or rather written) a servo library that piggybacks on the existing I/O loop. The good thing is that there's zero jitter and no "overflow" or "rollover" issues that is present in some libraries, and it seems to work pretty well. Although I had to guesstimate certain values, as the servos require a rather exact timing to function, it should be close enough for my purposes. I expect to trim and tune these parameters once everything is connected properly (like everything else) but it's nice to see the "last bastion" of remaining functions taken care of.

Furthermore, I've finalized solenoid, switch and light functions so they work properly and reliably with callbacks. I think I covered the switches in an older post, but the hits are buffered and executed in the order they were triggered and is put in the outside loop at ~40 Hz. 

For time critical events I've add high-prio callbacks that gets called right away in the inner loop (even before buffering the hit) that will be used by slingshots, flippers and bumpers, to ensure these solenoids gets triggered within the next microsecond. Sound, points and game related callbacks will run as usual in the outside I/O-loop. Hopefully this will, and should, make the game feel super snappy and responsive.

I've started the time consuming work of making the cables needed for connecting the new PCB-board to the pinball machine, and it's a few hundred meter cables that needs to be redone. Obviously I only do the ends of the cables, but still... ;)

So things are rolling once again, which is rather nice!


1) Doesn't exactly show the servos, but at least the colors are nice. ;) 

Friday, June 1, 2018

Not dead - just hibernating

Sorry for this update, hehe.
Many subscribers probably sees this thinking it's another fancy development post. ;)

I've got so much going on in my life at the moment, so there's just not any time to work on the machine (it's been almost five months since the last update! :O ). The machine isn't abandoned, so please check back from time to time, but there will probably not be any work done until August/September.

See you sooner than you think and thanks for helping me stay motivated through the years! :)

Sunday, January 28, 2018

Remembering The Past

Needed the soundboard from the "old system", so I opened up the pinball machine for the first time in a while... And I was actually surprised to see what a mess it was/is! It's a wonder it even worked at all, haha. :D

Anyhow -
It was quite satisfactory to see that where the old setup used tons of different boards, two MCU's and a cabling from hell, the new setup is ultra neat in comparison. And despite having "only" one MCU, the performance is 4x in most cases, but 200x when it comes to I/O. Hardware stability is improved a lot as well! I'm also pleased with the new code library compared to the old, which will make game programming a breeze.

The maintenance mode is always enabled, which gives me detailed input on sounds running, scenes started, sound and input / output etc - so I can see right away if there's a problem. Love it!

1) The old....monstrosity. This is actually HW3.0, if we're counting revisions.
HW4 (current) is seen in the post below, which despite being in development "mode", still looks tons better. 

Monday, January 22, 2018

Mostly Behind The Scenes

What is up, Internet!?

Most of the work at the moment isn't very visually interesting, but I'd thought I'd share a little snapshot of the current (messy) state of the debug screen. What I'm verifying here is that the various conversion and positioning functions are functioning properly. Which they are.

On top of this, I've fleshed out the switch callback handling, which includes buffered and queued switch hits. This allows the best of both worlds; the interrupt routine can register switch hits as fast as it can detect ( 1000+ > Hz per switch) while the game loop is chugging along at 40Hz. So no switch hits are missed, and the response for each hit is a maximum of 25ms late. Certain switches such as flippers, slingshots and bumpers are allowed to trigger the corresponding solenoid immediately and allow the sound and gameplay events to happen "later". It might be possible to queue sounds right away since the serial out is asynchronous, but I have yet to test this. What ever decision is made has to manage up to 8 simultaneous switch presses so each response must be pretty tight. I don't want the machine to run fine during single ball and crash during multiball etc. :)

I've enabled printing a copy of the internal switch matrix and the current animations, lights and so on in the console maintenance mode, which is guaranteed to be correct at all times unlike an offline version in Excel, for instance. On top of that I have started work on the state machine for modes and various scenes, so things are progressing nicely, albeit slowly!

1) Development board with debug options enabled on the DMD. I've also created a "overflow" function for scores,
so that any score larger than 999 999 999 will be visually divided by 1000 and rendered correctly. I believe this is how newer tables by Stern work, unless I'm mistaken.

Tuesday, October 17, 2017

Terminal Madness!

I decided it was time for a proper maintenance terminal function, so I coded up a rather crude but functional terminal maintenance function.

It goes hand in hand with logging boot status and game state changes etc, and will allow for _much_ speedier creation of game rules without actually pressing switches. Commands can also be chained, so I can easily create a sequence of actions to be simulated to properly activate features and modes instead of faking it by turning a specific mode flag on etc. This prevents me from mistakenly forgetting to reset something that might break the game - very handy! 
 
1) UECIDE (how's the new name going, Majenko? ;) ) with a terminal active. Me gusto. 
Now, if only there was a smart and efficient way of handling game code from EEPROM or SD-card. That would be excellent since a re-flash both take a long time and waste a full erase cycle on the Chipkit (a process that eventually will break the board).

It should be relatively easy to achieve, but it must be robust and extensible.

Monday, October 16, 2017

Weirdness and wetness!

Spent some more time with the code and got dual animations on a single SD-card up and running!
It's an unlimited number really, but limited to two for performance. The theory is simple, since I'm not using a file system I simply load raw sectors and can grab any frame at will.

For simplicity and synchronicity's sake, I've decided to load SD-card animations with a blocking approach (as opposed to interrupt driven). This greatly simplifies things as I can keep the main loop/scene rendering to a single function instead of spreading out across several frames and wait for various inputs to complete etc. Since switch inputs and all I/O in general is moved outside the main loop, it doesn't matter really. I've locked the main loop to 40Hz which should be plenty for updating animated text, verifying animations and other non critical reasons. 

1) Basic render "geometry" examples with background animation, textlayer and front animation (layered above the text-layer).
The lower left are status flags for SD card, MCP, ULN etc. All 8 should be lit for a 100% functional machine.


The extra FX-layer really spice up the DMD, since I can overlay smoke, sparks and what not at will. I could also use two background layers, or two front etc.

I've also found a way to successfully detect if ULN and MCPs are functioning correctly, and can alert and disable features accordingly. I've completely lacked this troubleshooting feature previously, so this is a major leap forward.

I've also had the "joy" of realizing that the flash-burning sometimes fails, and that verification fails. It has been like that for a while, and I never knew why and it has "always" worked. But this weekend some simple code started to fail seemingly randomly and it basically boiled down to 'if verification fails, the upload isn't correct' after all. Usually a reboot or reselecting the toolkit in UECIDE allow me to upload successfully. As long as I know about the issue I can work around it. It wasn't exactly a straight path trouble shooting it though, since I both suspected that the DMD was broken. I took a rewrite of the routine in a new sketch to see that it was indeed working correctly. A new screen is _not_ something I want to buy at this stage...

But on the plus side the 13h+ troubleshooting made me rewrite SD card and DMD rendering routines, further optimizing them and avoiding unnecessary variable writes and operations. The downside is tough-to-read code, but once in place they won't change often (at all?).

So - three steps forward, one temporary step back.