Archean

Archean

31 ratings
Color ore scanner
5
3
   
Award
Favorite
Favorited
Unfavorite
Blueprint: Machine, Computer
File Size
Posted
Updated
3.079 MB
19 Jun, 2024 @ 1:24am
5 Oct, 2024 @ 2:53am
22 Change Notes ( view )

Subscribe to download
Color ore scanner

Description
Scan for three different ores at once using a three-color scheme.

UI button to select:
-Ores to scan for
-Scanning range
-Stop or start scanning to save power


There's a section at the top of the code to specify ores to scan for, scanning speed, range and detail.

You can also artificially boost the return value of ores, so that if there's a trace amount of an ore, it will still output in a strong color.

Connected devices and aliases
If you're attaching the computer in another build

Attach the following devices via data cable and name each using the V key.
Screen
Port 0: Dashboard with screen. You can adjust the port, alias or dashboard screen number using the @SetOreScreen function in main.xc or where $screenOre is declared in the main code.

Devices
"ore_scanner": The Ore scanner on top of the pivot "ore_pivot": A robotic pivot (make sure to turn off servo mode with V) "speed": Speed sensor (can be dropped if $allowRestMode is 0) "angle": Angular speed sensor (can be dropped if $allowRestMode is 0) "terrain_scanner": Terrain scanner (optional)

Optional terrain scanner
If you attach a terrain scanner on port 5, you can select "land" and "sea" on the green and blue channel to show the terrain on screen.

Power saving features
When the vehicle isn't moving, the scanner stops turning and scanning to save power. This can be disabled by setting $allowRestMode to 0.
If you don't select either land or sea, the terrain scanner doesn't draw any power.
If no ores are selected, the ore scanner doesn't draw any power.

CPU/Server performance
If you want to reduce load on a multiplayer server, don't use the terrain scanning features ("land" and "sea"). It uses more of the server CPU than the ore scanner does. You can remove the terrain scanner without breaking the machine.
If you disconnect the speed and angle sensors it puts the scanner in a permanent rest mode (it thinks your vehicle is stationary at all times), then when you need to scan, just press one of the Range buttons to do a single scan.


Values you might want to tweak
; REST MODE. Set this to 0 if there's no speed sensor and angular velocity senor attached const $allowRestMode = 1 ; STARTING ORE SELECTION, can be changed in the on-screen config menu ; After the first start, these values are stored and reloaded after rebooting or editing code var $ore1Default="Fe" ;Iron, Red channel var $ore2Default="Cu" ;Copper, Green channel var $ore3Default="Al" ;Aluminium, Blue channel var $resetStoredValue = 0 ; override to reset stored values, set to 1 to fix any bugged ore values ; BOOST ORE VISIBILITY const $oreboost1=0 ; normal display const $oreboost2=0.5 ; any amount of ore will be displayed as at least 50% const $oreboost3=0.1 ; any amount of ore will be displayed as at least 10% ; CUSTOMIZE SCAN RANGES ON BUTTONS const $shortRange = 250 const $mediumRange = 500 const $longRange = 1000 ; ADJUST SCANNER ROTATION SPEED const $rotSpeed = 0.1 ; Change button sizes const $ButtonHeight = 25 ; Use this to limit power usage and server impact, but decrease the line density on screen. ; Max allowed is scan steps is 100, lower resolution screens use fewer lines. const $maxScanSteps = 40

Troubleshooting
If you see circular stripes in the output near the center, reduce the $maxScanSteps value or check that the scanner is connected directly to a battery. If power is routed through a junction, the scanner may run out of power before all scan steps are done per tick, and will output bad data.

Re-use in other workshop items is OK
If you want to incorporate this into your own workshop items, please do. No need to ask for permission.
(If you build something cool, or improve upon it, feel free to tell me)

Source code
The code is based on batcholi and Drya'd BMD's blueprints, but with extra bells and whistles.

If you want to load the code into a computer without spawning the blueprint, you can find the code here:

https://github.com/archean-cookbook/snjo-color-ore-scanner
13 Comments
ArchieFoxer 29 Apr @ 1:12pm 
Ah thanks, I either misunderstood the comments or didn't see it.
Snjo  [author] 29 Apr @ 8:40am 
@paullie Screens can't pass through bridges and junctions, only direct connection.

@archiefoxer Yes, it will take any signal > 0 and boost it up to the value, a boos vale of 0.5 changes a source signal of 0.0002 to 0.5, or half total brightness. 0.5 is usually overkill though, because it's useful to separate very faint resources from medium queality resources. There's also a multiplier value in there to play with. The code comments should explain it.
ArchieFoxer 29 Apr @ 2:15am 
@Snjo:
Does this also make stuff in the 0-1% range visible?
Paullie 28 Apr @ 2:01pm 
So i have dismantled it and rebuilt however i can only get the screen to work if it is plugged straight into port 0, i wanted to run it through a data bridge so i could tidy up the wiring a bit. any ideas?
Snjo  [author] 28 Apr @ 9:52am 
@archiefox Yes, you can use the oreboost variables. Check the description above. It requires you to edit the main code file, not via the UI. Set the boost value to any number between 0 and 1.
ArchieFoxer 26 Apr @ 1:54pm 
Can I somehow make the scanner more sensitive to scan for low density pockets of very rare stuff like flouride?
Snjo  [author] 5 Oct, 2024 @ 3:18am 
Updated after a game update to fix broken code. If you have integrated this into your own build, you can spawn this updated version separately and swap the disk into your build, or make the following changes manually:

file: ColorOreScanner.xc
line 325: remove ) at the end
line 382: add ) at the end
Ahdidaas 4 Sep, 2024 @ 5:50pm 
ty, it looks sweet!
Snjo  [author] 18 Jul, 2024 @ 1:11pm 
@tycho_leksten, go right ahead!
Tycho_Leksten 17 Jul, 2024 @ 4:59pm 
mind if i use your code as a base in my radar blue print that i was thinking about up loading as long as i give you and credit?