• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Would AI help me?

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Would AI help me?

    Coded in C for ESP32 about 5 years ago.
    If I update the libraries to the latest versions, the code won't compile.
    Obviously, I can still tweak code for functionality and continue with the old libraries which is how I have the development environment setup.

    Or I can upgrade the libraries and spend time rewriting as needed.

    Or, maybe AI could help me out by re-writing the code?
    I have never touched AI. Should I look at an AI code generator to update this?

    #2
    Do you have a test suite? With decent coverage? If so, then use any method you like and your test suite will tell you badly it has broken everything.

    Without a test suite I would not be going anywhere near AI. You'll spend more time fixing the problems it has introduced than you would have done just doing the re-write yourself.

    Comment


      #3
      Personally, I wouldn't use AI for this. As openstrike said, just because the code will compile, that doesn't mean that it's working correctly. (A simple "fix" would be to comment out every line of code!)

      However, as a wider question, what is this app/microcontroller used for? I.e. what's the impact if it goes wrong? And how obvious would that be? E.g. if this is controlling your central heating, and you'll know if the house gets too hot/cold, it's probably safe to let AI have a go (but make sure you have a backup). On the other hand, if this is controlling your lawn sprinklers, you might wind up with an expensive water bill.

      Comment


        #4
        Thanks for the replies.

        The microcontroller reads various sensors and ADCs and sends the data home where it gets stored in a sqlite DB so this is simple telemetry and doesn't control anything (although it's designed to do so and can it doesn't yet).

        The ESP32 connects to WiFi (a 4G mobile router) and then uses Mosquito for transport. So it's not hugely complicated and easy to test (I had spare PCBs made so that I have the necessary for testing). It's really just a number of nested loops. There's more code detecting lost connections and comms and re-connecting than there is for the core functionality.

        Time for a re-write. Probably good for the old brain cells.

        Comment


          #5
          Originally posted by Protagoras View Post
          Coded in C for ESP32 about 5 years ago.
          If I update the libraries to the latest versions, the code won't compile.
          Obviously, I can still tweak code for functionality and continue with the old libraries which is how I have the development environment setup.

          Or I can upgrade the libraries and spend time rewriting as needed.

          Or, maybe AI could help me out by re-writing the code?
          I have never touched AI. Should I look at an AI code generator to update this?
          Claude Code can handle stuff like this.

          Helps if you have tests.
          But you could also get it to write some tests for the original before you do the library migration. Its great at writing tests.

          Comment


            #6
            Originally posted by willendure View Post

            Claude Code can handle stuff like this.

            Helps if you have tests.
            But you could also get it to write some tests for the original before you do the library migration. Its great at writing tests.
            Agree. A sub is definitely worth the money as things are moving very quickly indeed.

            Comment

            Working...
            X